hugo-theme-relearn/layouts/shortcodes/tab.html
Swen Wenzel 0b5bb6e7b3
Implement tab views (#386)
Tab views from @swenzel
2021-03-16 17:21:57 +00:00

12 lines
370 B
HTML

{{ if .Parent }}
{{ $name := trim (.Get "name") " " }}
{{ if not (.Parent.Scratch.Get "tabs") }}
{{ .Parent.Scratch.Set "tabs" slice }}
{{ end }}
{{ with .Inner }}
{{ $.Parent.Scratch.Add "tabs" (dict "name" $name "content" . ) }}
{{ end }}
{{ else }}
{{- errorf "[%s] %q: tab shortcode missing its parent" site.Language.Lang .Page.Path -}}
{{ end}}