summaryrefslogtreecommitdiffstats
path: root/site/layouts/shortcodes/param.html
blob: 34ad00c87a8622007f99a25c3d38b3a668601108 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
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 -}}