Configure navigation on the TOC (table of contents)
Every markdown page includes a table of contents (TOC) that is automatically generated based on the headings. You can configure navigation on the TOC by updating the title for the TOC and setting the depth.
Update depth
You can update the title and set the depth for the TOC for all or select pages of your portal.
To set the depth of the TOC:
- If you don't already have a
redocly.yaml
file, create one and add it to the root of your project. - Add the
toc
object, under themarkdown
object. For example:markdown: toc:
- Add the
depth
option with the value for how many levels you want included in the TOC. For example, the following configuration sets the depth to include only level 2 headings:markdown: toc: depth: 2
Update title
The TOC header text can be customized using translation keys for localization. The translation key for the TOC header is toc.header
(default value: "On this page").
For more information about translation keys, refer to the Translation Keys Reference.