hugo-theme-relearn/layouts/shortcodes/tab.html

18 lines
617 B
HTML
Raw Normal View History

{{- $_hugo_config := `{ "version": 1 }` }}
{{- $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 }}