summaryrefslogtreecommitdiff
path: root/layouts/shortcodes/tab.html
diff options
context:
space:
mode:
Diffstat (limited to 'layouts/shortcodes/tab.html')
-rw-r--r--layouts/shortcodes/tab.html12
1 files changed, 12 insertions, 0 deletions
diff --git a/layouts/shortcodes/tab.html b/layouts/shortcodes/tab.html
new file mode 100644
index 0000000..24520e7
--- /dev/null
+++ b/layouts/shortcodes/tab.html
@@ -0,0 +1,12 @@
+{{ if .Parent }}
+ {{ $name := .Get 0 }}
+ {{ $group := printf "tabs-%s" (.Parent.Get 0) }}
+
+ {{ 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}}