summaryrefslogtreecommitdiffstats
path: root/layouts/partials/post-meta/date.html
diff options
context:
space:
mode:
authorSerghei Iakovlev <egrep@protonmail.ch>2022-05-31 09:35:31 +0200
committerSerghei Iakovlev <egrep@protonmail.ch>2022-05-31 09:35:31 +0200
commit41df0128d69b344050ef12f2dcd884e635a3299f (patch)
treeaf26f956b70c441675023d2105d1ff215458e6a9 /layouts/partials/post-meta/date.html
parent882af0656327476b523e0d6538b29ae9ad6eda28 (diff)
downloadgohugo-theme-ed-41df0128d69b344050ef12f2dcd884e635a3299f.tar.gz
Add tagging support
Diffstat (limited to 'layouts/partials/post-meta/date.html')
-rw-r--r--layouts/partials/post-meta/date.html21
1 files changed, 12 insertions, 9 deletions
diff --git a/layouts/partials/post-meta/date.html b/layouts/partials/post-meta/date.html
index 04a814a..e5626cf 100644
--- a/layouts/partials/post-meta/date.html
+++ b/layouts/partials/post-meta/date.html
@@ -1,11 +1,14 @@
-{{ if not .Date.IsZero }}
- <time datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">
- {{ .Date | time.Format (site.Params.dateformat | default "January 02, 2006") }}
- </time>
+{{ $date := .Date | time.Format (site.Params.dateformat | default "January 02, 2006") }}
+{{ $lastmod := .Lastmod | time.Format (site.Params.dateformat | default "January 02, 2006") }}
+
+<time datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">
+ {{ $date }}
+</time>
- {{ if ne .Date .Lastmod }}
- <time datetime="{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" }}">
- ({{ i18n "updated_at" }} {{ .Lastmod | time.Format (site.Params.dateformat | default "January 02, 2006") }})
- </time>
- {{ end }}
+{{/* Check that lastmod exists and is greater than date
+ (i.e. the last modified date must be after the publish date) */}}
+{{ if and (ne $lastmod $date) (gt .Lastmod .Date) }}
+ <time datetime="{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" }}">
+ ({{ i18n "updated_at" }} {{ $lastmod }})
+ </time>
{{ end }}