2020-05-05 20:49:12 +02:00
|
|
|
{{- /*
|
|
|
|
Work around wrong escapes in integrity attributes.
|
2021-01-16 20:51:12 +01:00
|
|
|
Original: https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/shortcodes/param.html
|
2020-05-05 20:49:12 +02:00
|
|
|
*/ -}}
|
|
|
|
|
|
|
|
{{- $name := .Get 0 -}}
|
|
|
|
{{- with $name -}}
|
|
|
|
{{- $value := $.Page.Param . -}}
|
2021-01-16 20:51:12 +01:00
|
|
|
{{- /* If any parameter ends with `_hash`, mark the string as safe HTML */ -}}
|
|
|
|
{{- if (strings.HasSuffix $name "_hash") -}}
|
2020-05-05 20:49:12 +02:00
|
|
|
{{- $value = $value | safeHTML -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- with $value }}{{ . }}{{ else }}{{ errorf "Param %q not found: %s" $name $.Position }}{{ end -}}
|
|
|
|
{{- else }}{{ errorf "Missing param key: %s" $.Position }}{{ end -}}
|