From 9bb9989fca490bfac69ea4387ccae1e9ec3ec23cf7f47a401e241ee43562f8a3 Mon Sep 17 00:00:00 2001 From: Nicholas Johnson <> Date: Sat, 26 Jul 2025 00:00:00 +0000 Subject: Migrate fully to Hugo's new template system This was the only way I could get term pages to consistently render correctly. --- layouts/_partials/pageinfo.html | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 layouts/_partials/pageinfo.html (limited to 'layouts/_partials/pageinfo.html') diff --git a/layouts/_partials/pageinfo.html b/layouts/_partials/pageinfo.html new file mode 100644 index 0000000..3ca8fe9 --- /dev/null +++ b/layouts/_partials/pageinfo.html @@ -0,0 +1,23 @@ +{{ $dateFormat := .Site.Params.dateFormat | default ":date_long" -}} + +{{/* user-overridable parameter $dateFormat is escaped pre-insertion so that HTML entities can be inserted */ -}} +{{ $nonBreakingPublishDate := .Page.PublishDate | time.Format $dateFormat | htmlEscape -}} +{{ $nonBreakingPublishDate = replace $nonBreakingPublishDate " " " " -}} +{{ $nonBreakingPublishDate = replace $nonBreakingPublishDate "-" "‑" -}} + +{{/* user-overridable parameter $readingTime is escaped pre-insertion so that HTML entities can be inserted */ -}} +{{ $nonBreakingReadingTime := i18n "readingTime" .ReadingTime | htmlEscape -}} +{{ $nonBreakingReadingTime = replace $nonBreakingReadingTime " " " " -}} +{{ $nonBreakingReadingTime = replace $nonBreakingReadingTime "-" "‑" -}} + +{{ $breakingTags := .Param (lower (i18n "tags")) -}} +{{ $nonBreakingTags := slice -}} +{{ range $breakingTags -}} + {{/* user-defined tags are escaped pre-insertion so that HTML entities can be inserted */ -}} + {{ $nonBreakingTag := htmlEscape . -}} + {{ $nonBreakingTag = replace $nonBreakingTag " " " " -}} + {{ $nonBreakingTag = replace $nonBreakingTag "-" "‑" -}} + {{ $nonBreakingTags = $nonBreakingTags | append $nonBreakingTag -}} +{{ end -}} + +{{ emojify ":calendar:" }}  | {{ emojify ":stopwatch:" }} {{ if $nonBreakingTags }} | {{ emojify ":label:" }} {{ end }}{{ range $key, $val := $nonBreakingTags }}{{ if $key }} {{ end }}{{ $val | safeHTML }}{{ end }} -- cgit v1.2.3