From b1881f00f5bf220bd2d698dd229ffb2d62263a6f Mon Sep 17 00:00:00 2001 From: Felipe Curty Date: Wed, 26 Mar 2025 01:50:31 -0300 Subject: [PATCH 1/2] Add Lastmod to the post --- layouts/partials/post_meta.html | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/layouts/partials/post_meta.html b/layouts/partials/post_meta.html index b0c0417e..895393f7 100644 --- a/layouts/partials/post_meta.html +++ b/layouts/partials/post_meta.html @@ -4,6 +4,10 @@ {{- $scratch.Add "meta" (slice (printf "%s" (.Date) (.Date | time.Format (default "January 2, 2006" site.Params.DateFormat)))) }} {{- end }} +{{- if not .Lastmod.IsZero -}} +{{- $scratch.Add "meta" (slice (printf "Last updated on %s" (.Lastmod) (.Lastmod | time.Format (default "January 2, 2006" .Site.Params.DateFormat)))) }} +{{- end }} + {{- if (.Param "ShowReadingTime") -}} {{- $scratch.Add "meta" (slice (i18n "read_time" .ReadingTime | default (printf "%d min" .ReadingTime))) }} {{- end }} From c7e471f4665b38a16b75b178eaeae0b8a5851b52 Mon Sep 17 00:00:00 2001 From: Felipe Curty Date: Wed, 26 Mar 2025 23:36:36 -0300 Subject: [PATCH 2/2] Handle when Date is equal to Lastmod --- layouts/partials/post_meta.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layouts/partials/post_meta.html b/layouts/partials/post_meta.html index 895393f7..037bab8c 100644 --- a/layouts/partials/post_meta.html +++ b/layouts/partials/post_meta.html @@ -4,7 +4,7 @@ {{- $scratch.Add "meta" (slice (printf "%s" (.Date) (.Date | time.Format (default "January 2, 2006" site.Params.DateFormat)))) }} {{- end }} -{{- if not .Lastmod.IsZero -}} +{{- if and (not .Lastmod.IsZero) (not (eq .Date .Lastmod)) -}} {{- $scratch.Add "meta" (slice (printf "Last updated on %s" (.Lastmod) (.Lastmod | time.Format (default "January 2, 2006" .Site.Params.DateFormat)))) }} {{- end }}