hugo-theme-relearn/layouts/shortcodes/tab.html
2023-05-23 23:57:48 +02:00

17 lines
No EOL
574 B
HTML

{{- $content := .Inner }}
{{- $name := (.Get "name") }}
{{- $tabs := slice }}
{{- if and .Parent (.Parent.Scratch.Get "tabs") }}
{{- $tabs = .Parent.Scratch.Get "tabs" }}
{{- end }}
{{- $tabs = $tabs | append (dict "name" (trim $name " ") "content" $content) }}
{{- if .Parent }}
{{- $.Parent.Scratch.Set "tabs" $tabs }}
{{- else }}
{{- $c:=""}}{{/* if no containing tabs shortcode is present, we display this tab as single */}}
{{- partial "shortcodes/tabs.html" (dict
"context" .Page
"groupid" ""
"content" $tabs
) }}
{{- end }}