Optionally show last modified on single template.
if `params.showLastmod: true` and `.Lastmod`'s timestamp is greater than `.Date`, show the last modified date next to the publish date.
This commit is contained in:
parent
4fe47ad315
commit
f38aa2904e
@ -26,6 +26,13 @@
|
||||
<time datetime="{{ $dateMachine }}">{{ $dateHuman }}</time>
|
||||
{{end}}
|
||||
|
||||
{{ if and (default false (.Param "showLastmod")) (gt .Lastmod .Date) }}
|
||||
{{ $dateMachine := .Lastmod | time.Format "2006-01-02T15:04:05-07:00" }}
|
||||
{{ $dateHuman := .Lastmod | time.Format (default ":date_long" $.Site.Params.singleDateFormat) }}
|
||||
·
|
||||
Updated <time datetime="{{ $dateMachine }}">{{ $dateHuman }}</time>
|
||||
{{end}}
|
||||
|
||||
{{ if .Param "readTime" }}
|
||||
·
|
||||
{{ .ReadingTime }} min read
|
||||
@ -96,4 +103,4 @@
|
||||
|
||||
</div>
|
||||
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
Loading…
Reference in New Issue
Block a user