summaryrefslogtreecommitdiff
path: root/layouts/_partials/pageinfo.html
diff options
context:
space:
mode:
authorNicholas Johnson <>2025-07-26 00:00:00 +0000
committerNicholas Johnson <>2025-07-26 00:00:00 +0000
commit9bb9989fca490bfac69ea4387ccae1e9ec3ec23cf7f47a401e241ee43562f8a3 (patch)
tree887dd23c15ddd56b850a4901b3161808bb37f1b1872fa40cbd2e2de877c3d77d /layouts/_partials/pageinfo.html
parentc1dc7133883e38b6c6ddf110df1868162862159994b2f9454999454f48417e58 (diff)
downloadhugo-theme-journal-9bb9989fca490bfac69ea4387ccae1e9ec3ec23cf7f47a401e241ee43562f8a3.tar.gz
hugo-theme-journal-9bb9989fca490bfac69ea4387ccae1e9ec3ec23cf7f47a401e241ee43562f8a3.zip
Migrate fully to Hugo's new template system
This was the only way I could get term pages to consistently render correctly.
Diffstat (limited to 'layouts/_partials/pageinfo.html')
-rw-r--r--layouts/_partials/pageinfo.html23
1 files changed, 23 insertions, 0 deletions
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 " " "&nbsp;" -}}
+{{ $nonBreakingPublishDate = replace $nonBreakingPublishDate "-" "&#8209;" -}}
+
+{{/* user-overridable parameter $readingTime is escaped pre-insertion so that HTML entities can be inserted */ -}}
+{{ $nonBreakingReadingTime := i18n "readingTime" .ReadingTime | htmlEscape -}}
+{{ $nonBreakingReadingTime = replace $nonBreakingReadingTime " " "&nbsp;" -}}
+{{ $nonBreakingReadingTime = replace $nonBreakingReadingTime "-" "&#8209;" -}}
+
+{{ $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 " " "&nbsp;" -}}
+ {{ $nonBreakingTag = replace $nonBreakingTag "-" "&#8209;" -}}
+ {{ $nonBreakingTags = $nonBreakingTags | append $nonBreakingTag -}}
+{{ end -}}
+
+{{ emojify ":calendar:" }}&nbsp;<time {{ printf "datetime=%q" (.Page.PublishDate | time.Format "2006-01-02T15:04:05-0700") | safeHTMLAttr }}>{{ $nonBreakingPublishDate | safeHTML }}</time> | {{ emojify ":stopwatch:" }}&nbsp;<time datetime="PT{{ .ReadingTime }}M">{{ $nonBreakingReadingTime | safeHTML }}</time>{{ if $nonBreakingTags }} | {{ emojify ":label:" }}&nbsp;{{ end }}{{ range $key, $val := $nonBreakingTags }}{{ if $key }} {{ end }}<a class="link link--internal" href='{{ relLangURL (lower (i18n "tags")) }}/{{ index $breakingTags $key | urlize }}/' rel="noreferrer">{{ $val | safeHTML }}</a>{{ end }}