From 19314ceff8db615fbc556cce371c3da639f32361 Mon Sep 17 00:00:00 2001 From: John Bowdre Date: Mon, 20 Dec 2021 16:00:09 -0600 Subject: [PATCH] display lastmod date if set and different from original post date --- i18n/en.toml | 5 +++- layouts/partials/post-meta.html | 41 +++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 layouts/partials/post-meta.html diff --git a/i18n/en.toml b/i18n/en.toml index 1356959..8385e2c 100644 --- a/i18n/en.toml +++ b/i18n/en.toml @@ -11,4 +11,7 @@ other = "All Rights Reserved" other = "Powered by" [and] -other = "and" \ No newline at end of file +other = "and" + +[updated] +other = "Updated" \ No newline at end of file diff --git a/layouts/partials/post-meta.html b/layouts/partials/post-meta.html new file mode 100644 index 0000000..ac4c63d --- /dev/null +++ b/layouts/partials/post-meta.html @@ -0,0 +1,41 @@ +{{- $showShare := ne (.Param "showshare") false }} +{{- $showDate := ne (.Param "showdate") false }} +{{- $postDate := .Date.Format (default "Jan 2, 2006" $.Site.Params.dateFormat) }} +{{- $updateDate := .Lastmod.Format (default "Jan 2, 2006" $.Site.Params.dateFormat) }} +{{- $showReadTime := ne (.Param "showreadtime") false }} +{{- $showPostMeta := or ($showShare) ($showDate) ($showReadTime) (isset .Params "tags") }} +{{- $scratch := newScratch }} +{{- $scratch.Set "writeSeparator" false }} +{{- if $showPostMeta }} +
+{{- end }} + {{- if $showDate }} + {{ partial "sprite" (dict "icon" "calendar") }} + + {{- $scratch.Set "writeSeparator" true }} + {{- end }} + {{- if $showReadTime }} + {{ if ($scratch.Get "writeSeparator") }} · {{ end }}{{ T "reading_time" . }} + {{- $scratch.Set "writeSeparator" true }} + {{- end }} + {{- with .Params.tags -}} + + {{- if ($scratch.Get "writeSeparator") }} · {{ end }} + {{- range . }} + {{- $tag := urlize . -}} + + {{- end }} + + {{- $scratch.Set "writeSeparator" true }} + {{- end }} + {{- if $showShare }} + {{ if ($scratch.Get "writeSeparator") }} ·{{ end }}{{ partial "share" . }} + {{- $scratch.Set "writeSeparator" true }} + {{- end }} +{{- if $showPostMeta }} +
+{{- end }}