Displaying update time on single posts
This commit is contained in:
parent
8678494542
commit
37c9ef6b0d
|
@ -1,6 +1,6 @@
|
|||
{{ define "main" }}
|
||||
<h1>{{ .Title }}</h1>
|
||||
{{ range .Pages.ByPublishDate.Reverse }}
|
||||
{{ range .Pages.ByLastmod.Reverse }}
|
||||
<p>
|
||||
<h3><a class="title" href="{{ .RelPermalink }}">{{ .Title }}</a></h3>
|
||||
{{ partial "metadata.html" . }}
|
||||
|
|
|
@ -1,9 +1,15 @@
|
|||
{{ $dateTime := .PublishDate.Format "2006-01-02" }}
|
||||
{{ $lastmodTime := .Lastmod.Format "2006-01-02" }}
|
||||
{{ $dateFormat := .Site.Params.dateFormat | default "Jan 2, 2006" }}
|
||||
<i data-feather="calendar"></i>
|
||||
{{ if .PublishDate }}
|
||||
{{ if and (ne $lastmodTime $dateTime) (gt .Lastmod .Date) }}
|
||||
<time datetime="{{ $lastmodTime }}">{{ .Lastmod.Format $dateFormat }}</time>
|
||||
(first posted <time datetime="{{ $dateTime }}">{{ .PublishDate.Format $dateFormat }}</time>)
|
||||
{{ else }}
|
||||
<time datetime="{{ $dateTime }}">{{ .PublishDate.Format $dateFormat }}</time>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ with .Params.tags }}
|
||||
<i data-feather="tag"></i>
|
||||
{{ range . }}
|
||||
|
|
Loading…
Reference in New Issue