diff options
Diffstat (limited to 'layouts/shortcodes/tab.html')
-rw-r--r-- | layouts/shortcodes/tab.html | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/layouts/shortcodes/tab.html b/layouts/shortcodes/tab.html new file mode 100644 index 0000000..ab1601d --- /dev/null +++ b/layouts/shortcodes/tab.html @@ -0,0 +1,14 @@ +<!-- https://github.com/alex-shpak/hugo-book/blame/master/layouts/shortcodes/tab.html --> +{{ if .Parent }} + {{ $name := .Get 0 }} + {{ $group := printf "tabs-%d" .Parent.Ordinal }} + + {{ if not (.Parent.Scratch.Get $group) }} + {{ .Parent.Scratch.Set $group slice }} + {{ end }} + + {{ .Parent.Scratch.Add $group (dict "Name" $name "Content" .Inner) }} + +{{ else }} + {{ errorf "%q: 'tab' shortcode must be inside 'tabs' shortcode" .Page.Path }} +{{ end}}
\ No newline at end of file |