From a8037bfbe85afd68a709657bda6d3860b84fbf77 Mon Sep 17 00:00:00 2001 From: Adam Ormsby Date: Sun, 10 Nov 2019 13:47:07 +0700 Subject: [PATCH] New feature - Display last modified date on post content in both list and single layouts if it exists. config param added - LastModDisplay - empty string = nothing displayed, string w/ value = display the value and then the date. Example - lastModDisplay = "Updated: " - displayed as "Updated: [lastmod date]" --- layouts/_default/list.html | 7 +++++++ layouts/_default/single.html | 11 +++++++++++ 2 files changed, 18 insertions(+) diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 4eec511..ae2912a 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -17,6 +17,13 @@ {{ .Date.Format ($.Site.Params.DateFormatList | default "2006-01-02") }} + {{ if $.Site.Params.LastModDisplay}} + {{ with .Lastmod }} + + {{ $.Site.Params.LastModDisplay }} {{ .Format ($.Site.Params.DateFormatSingle | default "2006-01-02") }} + + {{ end }} + {{ end }} {{ end }} {{ with .Params.Author }}— {{ $.Site.Params.WrittenBy | default "Written by" }} {{ . }}{{ end }} {{ if $.Site.Params.ShowReadingTime }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 262bc6c..1173f71 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -7,6 +7,17 @@ {{ .Format ($.Site.Params.DateFormatSingle | default "2006-01-02") }} {{ end }} + + {{ if $.Site.Params.LastModDisplay}} + {{ if .Date }} + {{ with .Lastmod }} + + {{ $.Site.Params.LastModDisplay }} {{ .Format ($.Site.Params.DateFormatSingle | default "2006-01-02") }} + + {{ end }} + {{ end }} + {{ end }} + {{ with .Params.Author }}— {{ $.Site.Params.WrittenBy | default "Written by" }} {{ . }}{{ end }} {{ if $.Site.Params.ShowReadingTime }} — {{ .ReadingTime }} {{ $.Site.Params.MinuteReadingTime | default "min read" }}