Hugo Tabs shortcode
For comparisons, and to save space, tabs are a useful UI element. This shortcode allows to easily create tabs in Hugo.
This article was written for Hugo 0.74
.
Usage
There are no options, you can define an unlimited amount of tabs. Markdown markup can be used within tabs.
Headings in the tab content will not be part of the table of contents.
Footnotes1 might behave different as expected, their scope is set per tab. Global footnotes cannot be used (e.g.
[^example3]
), see theLinux
example tab.
Example
{{< tabs >}}
{{< tab "MacOS" >}}
### MacOS
This is tab **MacOS** content.
Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat
stringit, frustra Saturnius uteroque inter!
{{< /tab >}}
{{< tab "Linux" >}}
## Linux
This is tab[^example2] **Linux** content.[^example3]
{{% hint warning %}}
Example text that *may* contain **markdown** `markup`.[^example]
[^example]: footnote within a hint.
{{% /hint %}}
[^example2]: footnote within a tab
{{< /tab >}}
{{< tab "Windows" >}}
### Windows
This is tab **Windows** content.
Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat
stringit, frustra Saturnius uteroque inter!
{{< /tab >}}
{{< /tabs >}}
MacOS
This is tab MacOS content.
Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat stringit, frustra Saturnius uteroque inter!
Linux
This is tab1 Linux content.[^example3]
Example text that may contain markdown
markup
.1
footnote within a hint. ↩︎
footnote within a tab ↩︎
Windows
This is tab Windows content.
Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat stringit, frustra Saturnius uteroque inter!
Code
The HTML shortcode, Tabs
:
|
|
Tab
shortcode, it will add its name and content to .Parent.Scratch
so the Tabs
shortcode can render it.
|
|
The accompanying SCSS
|
|
this is the default behavior ↩︎
- Permalink: //oostens.me/posts/hugo-tabs-shortcode/
- License: The text and content is licensed under CC BY-NC-SA 4.0. All source code I wrote on this page is licensed under The Unlicense; do as you please, I'm not liable nor provide warranty.