From 063c116bb55e776e1a2388db4894b977c410e02f Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Mon, 7 Feb 2022 14:47:30 +0100 Subject: [PATCH] fix: use safeHTML for description in metadata (#202) --- layouts/_default/list.atom.xml | 6 +++--- layouts/partials/head/meta.html | 2 +- layouts/partials/microformats/opengraph.html | 2 +- layouts/partials/microformats/schema.html | 4 ++-- layouts/partials/microformats/twitter_cards.html | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/layouts/_default/list.atom.xml b/layouts/_default/list.atom.xml index f97a91ec..ac6fcbc5 100644 --- a/layouts/_default/list.atom.xml +++ b/layouts/_default/list.atom.xml @@ -5,9 +5,9 @@ {{- if not (eq .Kind "home") }} {{- $title = printf `%s on %s` (partial "utils/title" .) $title -}} {{- end }} - {{ trim ($title | plainify) "\n" }} + {{ trim ($title | plainify) "\n" | safeHTML }} {{- with .Site.Params.subtitle }} - {{ trim (. | plainify) "\n" }} + {{ trim (. | plainify) "\n" | safeHTML }} {{- end }} {{- $output_formats := .OutputFormats -}} {{- range $output_formats -}} @@ -34,7 +34,7 @@ {{- end -}} {{- range $page := $pages }} - {{ trim (partial "utils/title" . | plainify) "\n" }} + {{ trim (partial "utils/title" . | plainify) "\n" | safeHTML }} {{ .Permalink }} {{- with .Params.authors }} diff --git a/layouts/partials/head/meta.html b/layouts/partials/head/meta.html index d6a3aad6..044c1019 100644 --- a/layouts/partials/head/meta.html +++ b/layouts/partials/head/meta.html @@ -7,7 +7,7 @@ {{- $authors := default (slice .Site.Params.GeekblogAuthor) .Params.authors -}} {{- with partial "utils/description" . }} - + {{- end }} {{- with $keywords }} diff --git a/layouts/partials/microformats/opengraph.html b/layouts/partials/microformats/opengraph.html index 1065cb96..bd4b5a98 100644 --- a/layouts/partials/microformats/opengraph.html +++ b/layouts/partials/microformats/opengraph.html @@ -5,7 +5,7 @@ {{- end }} {{- with partial "utils/description" . }} - + {{- end }} diff --git a/layouts/partials/microformats/schema.html b/layouts/partials/microformats/schema.html index 713f8a4c..b9206faf 100644 --- a/layouts/partials/microformats/schema.html +++ b/layouts/partials/microformats/schema.html @@ -11,7 +11,7 @@ "name": "{{ .Site.Title }}", "url": "{{ .Site.BaseURL }}", {{- with partial "utils/description" . }} - "description": "{{ trim (. | plainify) "\n" }}", + "description": "{{ trim (. | plainify) "\n" | safeHTML }}", {{- end }} "thumbnailUrl": "{{ $thumbnail }}" {{- with .Site.Params.GeekblogContentLicense }}, @@ -35,7 +35,7 @@ "alternativeHeadline": "{{ . }}", {{- end }} {{- with partial "utils/description" . }} - "description": "{{ trim (. | plainify) "\n" }}", + "description": "{{ trim (. | plainify) "\n" | safeHTML }}", {{- end }} "inLanguage": {{ .Site.Language.Lang }}, "isFamilyFriendly": "true", diff --git a/layouts/partials/microformats/twitter_cards.html b/layouts/partials/microformats/twitter_cards.html index 55097be4..86f96d43 100644 --- a/layouts/partials/microformats/twitter_cards.html +++ b/layouts/partials/microformats/twitter_cards.html @@ -21,7 +21,7 @@ {{- end }} {{- with partial "utils/description" . }} - + {{- end }} {{- with .Site.Social.twitter -}}