From fe2d028c74ad35151412e94697bc6db06fbeaefdc40a9d65ee707ba0e7695f89 Mon Sep 17 00:00:00 2001 From: Nicholas Johnson Date: Fri, 16 Sep 2022 00:00:00 +0000 Subject: Conditionally add page info to top of page --- layouts/partials/metadata.gmi | 6 ++---- layouts/partials/metadata.html | 3 +-- layouts/partials/pageinfo | 2 ++ 3 files changed, 5 insertions(+), 6 deletions(-) create mode 100644 layouts/partials/pageinfo (limited to 'layouts/partials') diff --git a/layouts/partials/metadata.gmi b/layouts/partials/metadata.gmi index b697ea0..368c3d3 100644 --- a/layouts/partials/metadata.gmi +++ b/layouts/partials/metadata.gmi @@ -1,11 +1,9 @@ {{ $entriesMinusOne := sub (len (where .Site.RegularPages.ByTitle "Section" "entry").ByPublishDate.Reverse) 1 }} {{- range first $entriesMinusOne (where .Site.RegularPages.ByTitle "Section" "entry").ByPublishDate.Reverse }} -{{- $dateFormat := .Site.Params.dateFormat | default "2 Jan 2006" -}} -📆 {{ .PublishDate.Format $dateFormat | safeHTML }} | ⏱️ {{ .ReadingTime | safeHTML }} minute read +{{- partial "pageinfo" . }} => .{{ .RelPermalink }} 🔗 {{ .Title | safeHTML }} {{ end }} {{- range last 1 (where .Site.RegularPages.ByTitle "Section" "entry").ByPublishDate.Reverse }} -{{- $dateFormat := .Site.Params.dateFormat | default "2 Jan 2006" -}} -📆 {{ .PublishDate.Format $dateFormat | safeHTML }} | ⏱️ {{ .ReadingTime | safeHTML }} minute read +{{- partial "pageinfo" . }} => .{{ .RelPermalink }} 🔗 {{ .Title | safeHTML }}{{ end }} diff --git a/layouts/partials/metadata.html b/layouts/partials/metadata.html index be9897b..844ea12 100644 --- a/layouts/partials/metadata.html +++ b/layouts/partials/metadata.html @@ -1,8 +1,7 @@ {{ range (where .Site.RegularPages.ByTitle "Section" "entry").ByPublishDate.Reverse -}} -{{ $dateFormat := .Site.Params.dateFormat | default "2 Jan 2006" -}}
-

📆 {{ .PublishDate.Format $dateFormat }} | ⏱️ {{ .ReadingTime }} minute read
+

{{ partial "pageinfo" . }}
🔗 {{ .Title }}

diff --git a/layouts/partials/pageinfo b/layouts/partials/pageinfo new file mode 100644 index 0000000..c512b88 --- /dev/null +++ b/layouts/partials/pageinfo @@ -0,0 +1,2 @@ +{{ $dateFormat := .Site.Params.dateFormat | default "2 Jan 2006" -}} +📆 {{ .Page.PublishDate.Format $dateFormat | safeHTML }} | ⏱️ {{ .Page.ReadingTime | safeHTML }} minute read \ No newline at end of file -- cgit v1.2.3