hugo-theme-relearn/layouts/shortcodes/include.html
Sören Weber 8551ee2738
shortcodes: revamp shortcodes #260 #261
- supply named parameter if missing #260
- fix boolean parameter if given as string #261
- revise documentation
2022-06-05 19:31:59 +02:00

10 lines
No EOL
419 B
HTML

{{- $file := .Get "file" | default (.Get 0) }}
{{- $showFirstHeading := .Get "showfirstheading" | default (.Get 1) | default true }}
{{- if eq (printf "%T" $showFirstHeading) "string" }}
{{- $showFirstHeading = (eq $showFirstHeading "true") }}
{{- end }}
{{- if not $showFirstHeading }}<div class="include hide-first-heading">{{ end }}
{{ $file | readFile | safeHTML }}
{{- if not $showFirstHeading }}</div>{{ end }}