summaryrefslogtreecommitdiffstats
path: root/site/layouts/shortcodes/param.html
diff options
context:
space:
mode:
Diffstat (limited to 'site/layouts/shortcodes/param.html')
-rw-r--r--site/layouts/shortcodes/param.html14
1 files changed, 14 insertions, 0 deletions
diff --git a/site/layouts/shortcodes/param.html b/site/layouts/shortcodes/param.html
new file mode 100644
index 0000000..34ad00c
--- /dev/null
+++ b/site/layouts/shortcodes/param.html
@@ -0,0 +1,14 @@
+{{- /*
+ Work around wrong escapes in integrity attributes.
+ Original: https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/shortcodes/param.html
+*/ -}}
+
+{{- $name := .Get 0 -}}
+{{- with $name -}}
+{{- $value := $.Page.Param . -}}
+{{- /* If any parameter ends with `_hash`, mark the string as safe HTML */ -}}
+{{- if (strings.HasSuffix $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 -}}