Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matcornic/hugo-theme-learn.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
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..d258e00
--- /dev/null
+++ b/layouts/shortcodes/tab.html
@@ -0,0 +1,12 @@
+{{ if .Parent }}
+ {{ $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 }}
+{{ else }}
+ {{- errorf "[%s] %q: tab shortcode missing its parent" site.Language.Lang .Page.Path -}}
+{{ end}}
+