From ddaf94cd3d60ca336963a8dc05d31eff48654ecb Mon Sep 17 00:00:00 2001 From: Wonderfall Date: Tue, 23 Aug 2022 17:02:53 +0200 Subject: [PATCH] add lastmod support --- layouts/_default/single.html | 3 +++ layouts/partials/post_lastmod.html | 6 ++++++ 2 files changed, 9 insertions(+) create mode 100644 layouts/partials/post_lastmod.html diff --git a/layouts/_default/single.html b/layouts/_default/single.html index b7497255..d7e3d136 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -19,6 +19,9 @@ {{- partial "edit_post.html" . -}} {{- partial "post_canonical.html" . -}} +
+ {{- partial "post_lastmod.html" . -}} +
{{- end }} {{- $isHidden := .Params.cover.hidden | default site.Params.cover.hiddenInSingle | default site.Params.cover.hidden }} diff --git a/layouts/partials/post_lastmod.html b/layouts/partials/post_lastmod.html new file mode 100644 index 00000000..750ff217 --- /dev/null +++ b/layouts/partials/post_lastmod.html @@ -0,0 +1,6 @@ +{{ $date := .Date.Format "02.01.2006" }} +{{ $lastmod := .Lastmod.Format "02.01.2006" }} + +{{- if ne $lastmod $date -}} +Last updated on {{ .Lastmod | time.Format (default "January 2, 2006" site.Params.DateFormat) }} +{{- end }} \ No newline at end of file