add lastmod support

This commit is contained in:
Wonderfall 2022-08-23 17:02:53 +02:00
parent f625367ff7
commit ddaf94cd3d
2 changed files with 9 additions and 0 deletions

View File

@ -19,6 +19,9 @@
{{- partial "edit_post.html" . -}}
{{- partial "post_canonical.html" . -}}
</div>
<div class="post-meta">
{{- partial "post_lastmod.html" . -}}
</div>
{{- end }}
</header>
{{- $isHidden := .Params.cover.hidden | default site.Params.cover.hiddenInSingle | default site.Params.cover.hidden }}

View File

@ -0,0 +1,6 @@
{{ $date := .Date.Format "02.01.2006" }}
{{ $lastmod := .Lastmod.Format "02.01.2006" }}
{{- if ne $lastmod $date -}}
<span title={{ .Lastmod }}><i>Last updated on {{ .Lastmod | time.Format (default "January 2, 2006" site.Params.DateFormat) }}</i></span>
{{- end }}