From f9793078331a338c605edff963b54135c836b940 Mon Sep 17 00:00:00 2001 From: Regis Philibert Date: Tue, 5 May 2020 21:49:12 +0300 Subject: [PATCH] Add a param shortcode to work around the escaped characters in hashes --- site/layouts/shortcodes/param.html | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 site/layouts/shortcodes/param.html diff --git a/site/layouts/shortcodes/param.html b/site/layouts/shortcodes/param.html new file mode 100644 index 0000000000..50e2060ae2 --- /dev/null +++ b/site/layouts/shortcodes/param.html @@ -0,0 +1,12 @@ +{{- /* + Work around wrong escapes in integrity attributes. +*/ -}} + +{{- $name := .Get 0 -}} +{{- with $name -}} +{{- $value := $.Page.Param . -}} +{{- if in $name "_hash" -}} + {{- $value = $value | safeHTML -}} +{{- end -}} +{{- with $value }}{{ . }}{{ else }}{{ errorf "Param %q not found: %s" $name $.Position }}{{ end -}} +{{- else }}{{ errorf "Missing param key: %s" $.Position }}{{ end -}}