mirror of
https://github.com/alex-shpak/hugo-book.git
synced 2025-04-22 07:01:36 +00:00
#672: Add tabs unique ID for nested tabs, uses .Ordinal by default
This commit is contained in:
parent
f889e52566
commit
60f4c03b8b
@ -3,7 +3,7 @@
|
|||||||
Tabs let you organize content by context, for example installation instructions for each supported platform.
|
Tabs let you organize content by context, for example installation instructions for each supported platform.
|
||||||
|
|
||||||
```tpl
|
```tpl
|
||||||
{{%/* tabs */%}}
|
{{%/* tabs "id" */%}}
|
||||||
{{%/* tab "MacOS" */%}} # MacOS Content {{%/* /tab */%}}
|
{{%/* tab "MacOS" */%}} # MacOS Content {{%/* /tab */%}}
|
||||||
{{%/* tab "Linux" */%}} # Linux Content {{%/* /tab */%}}
|
{{%/* tab "Linux" */%}} # Linux Content {{%/* /tab */%}}
|
||||||
{{%/* tab "Windows" */%}} # Windows Content {{%/* /tab */%}}
|
{{%/* tab "Windows" */%}} # Windows Content {{%/* /tab */%}}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{{- $group := printf "tabs-%d" .Parent.Ordinal -}}
|
{{- $group := printf "tabs-%s" (default .Parent.Ordinal (.Parent.Get 0)) -}}
|
||||||
{{- $tab := printf "%s-%d" $group .Ordinal }}
|
{{- $tab := printf "%s-%d" $group .Ordinal }}
|
||||||
<input type="radio" class="toggle" name="{{ $group }}" id="{{ $tab }}" {{ if not .Ordinal }}checked="checked"{{ end }} />
|
<input type="radio" class="toggle" name="{{ $group }}" id="{{ $tab }}" {{ if not .Ordinal }}checked="checked"{{ end }} />
|
||||||
<label for="{{ $tab }}">
|
<label for="{{ $tab }}">
|
||||||
|
Loading…
Reference in New Issue
Block a user