From 05422f3a36eb406451d714f16204d8cded3e7fb8eb06131948c2da05749ec20d Mon Sep 17 00:00:00 2001 From: Nicholas Johnson Date: Fri, 24 Feb 2023 00:00:00 +0000 Subject: Declare safeHTML where possible --- layouts/_default/single.gmi | 2 +- layouts/_default/single.html | 2 +- layouts/_default/taxonomy.gmi | 2 +- layouts/index.gmi | 2 +- layouts/index.html | 2 +- layouts/partials/metadata.gmi | 4 ++-- layouts/partials/pageinfo.gmi | 2 +- layouts/partials/pageinfo.html | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/layouts/_default/single.gmi b/layouts/_default/single.gmi index 54c4070..d164f8e 100644 --- a/layouts/_default/single.gmi +++ b/layouts/_default/single.gmi @@ -1,6 +1,6 @@ {{ define "main" }} {{ $emoji := cond (.Page.Params.showlinkemoji | default true) (emojify ":link: ") "" -}} -=> / {{ emojify ":link:" }} Return to homepage +=> / {{ emojify ":link:" | safeHTML }} Return to homepage {{ if (.Page.Params.pageinfo | default true) }}{{ partial "pageinfo.gmi" . }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 6870ecc..d0cc6a3 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -1,6 +1,6 @@ {{ define "main" -}} {{- if (.Page.Params.pageinfo | default true) }}

{{ partial "pageinfo.html" . }}

{{ end }} diff --git a/layouts/_default/taxonomy.gmi b/layouts/_default/taxonomy.gmi index f0a4b63..ad90191 100644 --- a/layouts/_default/taxonomy.gmi +++ b/layouts/_default/taxonomy.gmi @@ -1,6 +1,6 @@ {{ define "main" -}} # All {{ .Type }} {{- range .Data.Pages }} -=> {{ .RelPermalink }} {{ emojify ":link:" }} {{ .Title }} +=> {{ .RelPermalink }} {{ emojify ":link:" | safeHTML }} {{ .Title | safeHTML }} {{- end }} {{- end }} diff --git a/layouts/index.gmi b/layouts/index.gmi index b5b9e21..ae45ded 100644 --- a/layouts/index.gmi +++ b/layouts/index.gmi @@ -4,7 +4,7 @@ ## Navigation Links {{ range .Site.Menus.main -}} -=> {{ .URL }} {{ emojify ":link:" }} {{ .Name | safeHTML }} +=> {{ .URL }} {{ emojify ":link:" | safeHTML }} {{ .Name | safeHTML }} {{ end }} ## Journal Entries {{ partial "metadata.gmi" . }}{{ end }} diff --git a/layouts/index.html b/layouts/index.html index 9c4bb45..3ba0607 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -6,7 +6,7 @@ diff --git a/layouts/partials/metadata.gmi b/layouts/partials/metadata.gmi index 5e05721..c3d7af4 100644 --- a/layouts/partials/metadata.gmi +++ b/layouts/partials/metadata.gmi @@ -1,10 +1,10 @@ {{ $entriesMinusOne := sub (len (where .Site.RegularPages.ByTitle "Section" "entry").ByPublishDate.Reverse) 1 }} {{- range first $entriesMinusOne (where .Site.RegularPages.ByTitle "Section" "entry").ByPublishDate.Reverse }} {{- partial "pageinfo.gmi" . }} -=> {{ .RelPermalink }} {{ emojify ":link:" }} {{ .Title | safeHTML }} +=> {{ .RelPermalink }} {{ emojify ":link:" | safeHTML }} {{ .Title | safeHTML }} {{ end }} {{- range last 1 (where .Site.RegularPages.ByTitle "Section" "entry").ByPublishDate.Reverse }} {{- partial "pageinfo.gmi" . }} -=> {{ .RelPermalink }} {{ emojify ":link:" }} {{ .Title | safeHTML }}{{ end }} \ No newline at end of file +=> {{ .RelPermalink }} {{ emojify ":link:" | safeHTML }} {{ .Title | safeHTML }}{{ end }} \ No newline at end of file diff --git a/layouts/partials/pageinfo.gmi b/layouts/partials/pageinfo.gmi index 779a370..7ec43ff 100644 --- a/layouts/partials/pageinfo.gmi +++ b/layouts/partials/pageinfo.gmi @@ -1,2 +1,2 @@ {{ $dateFormat := .Site.Params.dateFormat | default "2 Jan 2006" -}} -{{ emojify ":calendar:" }} {{ .Page.PublishDate.Format $dateFormat | safeHTML }} | {{ emojify ":stopwatch:" }} {{ .Page.ReadingTime | safeHTML }} minute read{{ if .Page.Params.Tags }} | {{ emojify ":label:" }} {{ end }}{{ range $key, $val := .Page.Params.Tags }}{{ if $key }}, {{ end }}{{ $val }}{{ end }} \ No newline at end of file +{{ emojify ":calendar:" | safeHTML }} {{ .Page.PublishDate.Format $dateFormat | safeHTML }} | {{ emojify ":stopwatch:" | safeHTML }} {{ .Page.ReadingTime | safeHTML }} minute read{{ if .Page.Params.Tags }} | {{ emojify ":label:" | safeHTML }} {{ end }}{{ range $key, $val := .Page.Params.Tags }}{{ if $key }}, {{ end }}{{ $val }}{{ end }} \ No newline at end of file diff --git a/layouts/partials/pageinfo.html b/layouts/partials/pageinfo.html index c6643dc..5aca1c2 100644 --- a/layouts/partials/pageinfo.html +++ b/layouts/partials/pageinfo.html @@ -1,2 +1,2 @@ {{ $dateFormat := .Site.Params.dateFormat | default "2 Jan 2006" -}} -{{ emojify ":calendar:" }} {{ .Page.PublishDate.Format $dateFormat | safeHTML }} | {{ emojify ":stopwatch:" }} {{ .Page.ReadingTime | safeHTML }} minute read{{ if .Page.Params.Tags }} | {{ emojify ":label:" }} {{ end }}{{ range $key, $val := .Page.Params.Tags }}{{ if $key }}, {{ end }}{{ $val }}{{ end }} +{{ emojify ":calendar:" | safeHTML }} {{ .Page.PublishDate.Format $dateFormat | safeHTML }} | {{ emojify ":stopwatch:" | safeHTML }} {{ .Page.ReadingTime | safeHTML }} minute read{{ if .Page.Params.Tags }} | {{ emojify ":label:" | safeHTML }} {{ end }}{{ range $key, $val := .Page.Params.Tags }}{{ if $key }}, {{ end }}{{ $val }}{{ end }} -- cgit v1.2.3