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 c313ba8c05
commit d8eaad0f0c
2 changed files with 7 additions and 4 deletions

View file

@ -12,11 +12,13 @@
</header> </header>
{{ range $pages }} {{ range $pages }}
{{- $postDate := .Date.Format "2006-01-02" }}
{{- $updateDate := .Lastmod.Format "2006-01-02" }}
<article class="post"> <article class="post">
<header class="post__header"> <header class="post__header">
<h1><a href="{{ .Permalink }}">{{ .Title | markdownify }}</a></h1> <h1><a href="{{ .Permalink }}">{{ .Title | markdownify }}</a></h1>
<p class="post__meta"> <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> </p>
</header> </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 }} {{ if .Params.description }}<p>{{ .Params.description }}</p>{{ end }}
<p> <p>
{{ if .Params.author }}By {{ .Params.author }}{{ if .Date }}, {{ end }}{{ end }} {{ with $postDate }}{{ . }}{{ end }}{{- if ne $postDate $updateDate }} [{{ $updateDate }}]{{ end }}
{{ if .Date }}{{ .Date.Format "2006-01-02" }}{{ end }}
</p> </p>
<p> <p>
{{- with .Params.tags -}} {{- with .Params.tags -}}