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]"
This commit is contained in:
Adam Ormsby 2019-11-10 13:47:07 +07:00
parent 8759dd6b38
commit a8037bfbe8
2 changed files with 18 additions and 0 deletions

View File

@ -17,6 +17,13 @@
<span class="post-date">
{{ .Date.Format ($.Site.Params.DateFormatList | default "2006-01-02") }}
</span>
{{ if $.Site.Params.LastModDisplay}}
{{ with .Lastmod }}
<span class="post-moddate">
{{ $.Site.Params.LastModDisplay }} {{ .Format ($.Site.Params.DateFormatSingle | default "2006-01-02") }}
</span>
{{ end }}
{{ end }}
{{ end }}
{{ with .Params.Author }}<span class="post-author">— {{ $.Site.Params.WrittenBy | default "Written by" }} {{ . }}</span>{{ end }}
{{ if $.Site.Params.ShowReadingTime }}

View File

@ -7,6 +7,17 @@
{{ .Format ($.Site.Params.DateFormatSingle | default "2006-01-02") }}
</span>
{{ end }}
{{ if $.Site.Params.LastModDisplay}}
{{ if .Date }}
{{ with .Lastmod }}
<span class="post-moddate">
{{ $.Site.Params.LastModDisplay }} {{ .Format ($.Site.Params.DateFormatSingle | default "2006-01-02") }}
</span>
{{ end }}
{{ end }}
{{ end }}
{{ with .Params.Author }}<span class="post-author">— {{ $.Site.Params.WrittenBy | default "Written by" }} {{ . }}</span>{{ end }}
{{ if $.Site.Params.ShowReadingTime }}
<span class="post-read-time">— {{ .ReadingTime }} {{ $.Site.Params.MinuteReadingTime | default "min read" }}</span>