2024-01-20 18:16:07 +00:00
You can add a table of contents to a page using `toc` [[Blocks]].
2023-11-25 13:08:48 +00:00
2024-01-08 16:08:26 +00:00
In its most basic form it looks like this (click the edit button to see the code):
```toc
```
You can use it in two ways:
1. _Manually_ , by adding a `toc` widget to the pages where you’ d like to render a ToC
2. _Automatically_ , using a [[Live Template Widgets|Live Template Widget]]
2024-01-20 18:16:07 +00:00
To have a ToC added to all pages with a larger (e.g. 3) number of headings, it is recommended to use [[Library/Core/Widget/Table of Contents|this template widget]].
2024-01-08 16:08:26 +00:00
## Configuration
In the body of the `toc` code widget you can configure a few options:
* `header` : by default a “Table of Contents” header is added to the ToC, set this to `false` to disable rendering this header
2024-01-09 13:02:08 +00:00
* `minHeaders` : only renders a ToC if the number of headers in the current page exceeds this number, otherwise renders an empty widget
* `maxHeaders` : only renders a ToC if the number of headers in the current page is below this number, otherwise renders an empty widget
2024-01-08 16:08:26 +00:00
Example:
```toc
header: false
minHeaders: 1
```
2024-01-20 18:16:07 +00:00
Want to add a table of contents to all your pages automatically? You can — that’ s functionality available via the [[Library/Core]] library.