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

35 lines
1.2 KiB
Markdown
Raw Normal View History

2017-07-14 18:26:35 +02:00
+++
title = "Tables of contents"
+++
2017-11-02 16:37:06 +01:00
Pattern pages in **Cupper** 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 "Setup" %}} page looks something like this:
2017-07-14 18:26:35 +02:00
```html
<nav class="toc" aria-labelledby="toc-heading">
<h2 id="toc-heading">Table of contents</h2>
<ol>
<li>
2017-07-14 19:33:53 +02:00
<a href="#cleaning-the-content-folder">“Cleaning” the content folder</a>
2017-07-14 18:26:35 +02:00
</li>
<li>
2017-07-14 19:33:53 +02:00
<a href="#the-setup-command">The setup command</a>
2017-07-14 18:26:35 +02:00
</li>
<li>
2017-07-14 19:33:53 +02:00
<a href="#the-config-file">The config file</a>
2017-07-14 18:26:35 +02:00
</li>
<li>
2017-07-14 19:33:53 +02:00
<a href="#including-a-logo">Including a logo</a>
2017-07-14 18:26:35 +02:00
</li>
</ol>
</nav>
```
2017-09-07 10:31:52 +02:00
Tables of content 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 content off by adding `toc = false` to the TOML metadata for your pattern:
2017-07-14 18:26:35 +02:00
```
+++
title = "My page with a few headings"
toc = false
+++
```