display lastmod date on single sidebar and archive list

This commit is contained in:
John Bowdre 2023-08-28 13:48:46 -05:00
parent 2a5c9eb6d0
commit fb0d3c3788
2 changed files with 7 additions and 4 deletions

View file

@ -12,11 +12,13 @@
</header>
{{ range $pages }}
{{- $postDate := .Date.Format "2006-01-02" }}
{{- $updateDate := .Lastmod.Format "2006-01-02" }}
<article class="post">
<header class="post__header">
<h1><a href="{{ .Permalink }}">{{ .Title | markdownify }}</a></h1>
<p class="post__meta">
<span class="date">{{ .Date.Format "2 January 2006" }}</span>
<span class="date">{{ $postDate }}{{- if ne $postDate $updateDate }} [{{ $updateDate }}]{{ end }}</span>
</p>
</header>

View file

@ -1,8 +1,9 @@
{{ if or (.Params.description) (.Params.author) (.Params.date) }}
{{- $postDate := .Date.Format "2006-01-02" }}
{{- $updateDate := .Lastmod.Format "2006-01-02" }}
{{ if or (.Params.description) (.Params.date) }}
{{ if .Params.description }}<p>{{ .Params.description }}</p>{{ end }}
<p>
{{ if .Params.author }}By {{ .Params.author }}{{ if .Date }}, {{ end }}{{ end }}
{{ if .Date }}{{ .Date.Format "2006-01-02" }}{{ end }}
{{ with $postDate }}{{ . }}{{ end }}{{- if ne $postDate $updateDate }} [{{ $updateDate }}]{{ end }}
</p>
<p>
{{- with .Params.tags -}}