aboutsummaryrefslogtreecommitdiff
path: root/layouts/_partials/pageinfo.html
diff options
context:
space:
mode:
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 " " " " -}}
+{{ $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:" }}&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 }}