Back to top

ToC

Add table of contents of any content fragment to the page.

ToC fragment can be used to render Table of Contents of any content fragment from any page. The default behavior is to get the name of the content fragment on the same page:

content = "content.md"

But if you need to get the Table of Contents of other pages, just address them relative to the content directory:

content = "fragments/hero/index.md"
Code
fragment = "toc"
weight = 110
background = "secondary"
content = "content.md"
+++

Code (content.md)
fragment = "content"
weight = 111
disabled = true # This is just to prevent rendering of the content on the documentation
+++

# Sample header 1
## Sample header 2
### Sample header 3
## Sample header 2

Documentation

This fragment renders table of contents of a content fragment. It can be used standalone, or in a slot in list or content fragment.

If it’s standalone, then the content fragment is required.

Variables

content

type: string
required

Path to the content fragment that you need the table of contents of. This path can be relative to the page or relative to content/ directory.

Global variables are documented as well and have been omitted from this page.