Some of my posts are lists of cases, which change over time. Ideally, I want each post to show when I created the original post and when I updated it.
layout for post metadata,
layouts/partials/post_meta.html, does not
include the date the post was last modified. Fortunately, Hugo has a
predefined frontmatter variable,
which allows an author to store that data.
Even better, Hugo’s Git integration can derive the
from the file’s Git history.
Hugo will automatically pull the
lastmod value from the Git history,
but the author can manually override the
lastmod value in the frontmatter.
wrote a great post about integrating the two approaches.
I adapted the solution in PaperMod. Firest, I added this key to
Next, I copied the theme’s
my project folder and modified it.
The code below displays the
lastmod date only if it differs
from the frontmatter
It works great.