docs/layouts/shortcodes/tab.html

13 lines
345 B
HTML

{{ if ne .Parent.Name "tabs" }}
{{- errorf "tab shortcode missing its 'tabs' parent: %s" .Position -}}
{{ end }}
{{ $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 }}