cupper-hugo-theme/content/patterns/writing/tables-of-contents.md

43 lines
1.2 KiB
Markdown
Raw Normal View History

2017-07-14 18:26:35 +02:00
+++
title = "Tables of contents"
+++
Pattern pages in **Infusion** that have two or more subheadings — `<h2>`s — automatically get a **table of contents**: a list of links to the main subsections for the page. This feature is made accessible as a navigation region with the "Table of contents" label and uses an ordered list. The table of contents markup for the {{% pattern "Library setup" %}} page looks something like this:
```html
<nav class="toc" aria-labelledby="toc-heading">
<h2 id="toc-heading">Table of contents</h2>
<ol>
<li>
<a href="#cleaning-the-content-folder">
“Cleaning” the content folder
</a>
</li>
<li>
<a href="#the-setup-command">
The setup command
</a>
</li>
<li>
<a href="#the-config-file">
The config file
</a>
</li>
<li>
<a href="#including-a-logo">
Including a logo
</a>
</li>
</ol>
</nav>
```
Tables of contents are a neat way to break down the content of the page and give users a navigable overview. However, they may not be to your taste. Never fear, you can turn tables of contents off by adding `toc = false` to the TOML metadata for your pattern:
```
+++
title = "My page with a few headings"
toc = false
+++
```