Considering Confluence Cloud?
Get the high-level details of Confluence Cloud and available features by plan.
The Table of Contents macro scans the headings on the current Confluence page to create a table of contents based on those headings. This helps readers find their way around lengthy pages, by summarizing the content structure, and by providing links to headings.
Any text formatted as a heading along with emojis, mentions, statuses, and dates are available for inclusion in your table of contents.
To add a Table of Contents to your page:
From the editor, select (icon) from the toolbar to bring up the insert menu.
Find the Table of contents macro and select it. You can also type /tableofcontents to select this macro from the insert menu right in the body of your page.
3. Upon selection, the Table of Contents placeholder will appear in the body of your page.
4. Your table of contents won’t be visible while editing. When you preview the page or publish it, you’ll be able to see an auto-generated table of contents based on the page’s headings.
To configure your Table of Contents:
From the editor, select the Table of Contents placeholder.
Select the Edit () icon to open the configuration panel.
Customize the parameters of your table of contents in either Basic or Advanced mode.
Your selections won’t be visible while editing. When you preview the page or publish it, you’ll be able to see how your customized table of contents looks.
As you continue editing the page, the configuration panel will close.
You can also select the centered, medium-width, or full-width icon to adjust the width of your table of contents. Select the copy icon to duplicate it elsewhere, and/or the trashcan icon to remove it entirely.
Parameters are options that you can configure to control exactly how your table of contents appears on the page.
To customize your table of contents, you can configure its basic and/or advanced parameters, depending on your needs and preference.
Basic parameter | Default | Description | Example |
---|---|---|---|
Display as | Vertical list |
| |
Bullet style | Bullet | This parameter applies to vertical lists only.
| |
Separate sections by | Bracket | This parameter applies to horizontal lists only.
| |
Include heading levels from [#] to [#] | 1-6 | Select the minimum and maximum heading levels to include in your table of contents. | |
Include section numbers | Unchecked | Select the checkbox to apply outline numbering to your headings. (Example: 1.1, 1.2, 1.3) |
For advanced parameters, if the parameter name used in Confluence Cloud storage format or wikimarkup is different than the label used when inserting macros using the browser or the slash command, it will be listed below in brackets (example).
Advanced parameter | Description |
---|---|
Indent headings | Sets the indent for a vertical list according to a valid CSS unit value. |
Include Headings with: | Filter headings to include in your table of contents by inputting specific criteria. You can use wildcard characters. If you only want the Overview and Summary headings to appear, enter Overview|Summary in this field.
This field is case-sensitive. Enter both forms of the word if you want both instances to be included. |
Exclude Headings with: | Filter headings to exclude from your table of contents by inputting specific criteria. You can use wildcard characters. If the headings you want to exclude are Overview and Summary, enter Overview|Summary in this field.
This field is case-sensitive. Enter both forms of the word if you want both instances to be excluded. |
CSS class name | If you have custom TOC styles in your CSS style sheet, use this parameter to output the TOC inside <div> tags with the specified class attribute. |
Exclude in PDF export | If the box is checked, the TOC will not be visible when you export the page to PDF and/or print it. |
Wiki markup is only supported in the legacy editor.
Wiki markup is useful when you need to add a macro outside the editor, for example as custom content in the sidebar, header or footer of a space.
Macro name: toc
Macro body: None.
This example shows a list-type table of contents.
1
2
3
4
{toc:printable=true|style=square|maxLevel=2|indent=5px|minLevel=2|class=bigpink|exclude=[1//2]|type=list|outline=true|include=.*}
This example shows a flat table of contents.
1
2
3
4
{toc:printable=true|maxLevel=2|minLevel=2|class=bigpink|exclude=[1//2]|type=flat|outline=true|separator=pipe|include=.*}
When you use a Table of Contents macro in a template, the TOC won’t render in the template itself. But the Table of Contents macro will always work on pages created from the template – after the page has been saved.
The Table of Contents macro only displays page or blog post content.
The Table of Contents macro only works within the page, blog, or macro to which it has been added, and cannot reference or be referenced across multiple pages or blogs. When added to an Excerpt macro, for example, it will only display headings located inside the excerpt and those heading links won’t navigate to the source page.
Was this helpful?