diff --git a/README.md b/README.md index 79532479..aa357e3a 100644 --- a/README.md +++ b/README.md @@ -268,6 +268,7 @@ These options can be set from a page [frontmatter](https://gohugo.io/content-man |:-------------------- | ------------------ | ---------------- | | title | string | N/A | | date | date | N/A | +| lastmod | date | N/A | | description | string | N/A | | keywords | array of strings | yes | | introDescription | string | yes | @@ -291,6 +292,8 @@ These options can be set from a page [frontmatter](https://gohugo.io/content-man | comments | boolean | yes | | enableMathNotation | boolean | yes | | showDate | boolean | N/A | +| showLastmod | boolean | N/A | +| lastmodSeparator | string | N/A | | showShare | boolean | N/A | | showReadTime | boolean | N/A | | sidebar | boolean | N/A | diff --git a/layouts/partials/post-meta.html b/layouts/partials/post-meta.html index e46eb0e8..386ae114 100644 --- a/layouts/partials/post-meta.html +++ b/layouts/partials/post-meta.html @@ -1,5 +1,7 @@ {{- $showShare := ne (.Param "showshare") false }} {{- $showDate := ne (.Param "showdate") false }} +{{- $showLastmod := default false (.Param "showLastmod") }} +{{- $lastmodSeparator := default "/" (.Param "lastmodSeparator") }} {{- $showReadTime := ne (.Param "showreadtime") false }} {{- $showPostMeta := or ($showShare) ($showDate) ($showReadTime) (isset .Params "tags") }} {{- $scratch := newScratch }} @@ -11,6 +13,10 @@ {{ partial "sprite" (dict "icon" "calendar") }} {{ .Date.Format (default "Jan 2, 2006" $.Site.Params.dateFormat) -}} + {{ if (and $showLastmod (ne .Date .Lastmod)) }} + {{ $lastmodSeparator }} + {{ end }} {{- $scratch.Set "writeSeparator" true }} {{- end }}