You're using an outdated browser

For a better experience, keep your browser up to date. Check here for the latest version.


Rendering Table of Contents macro

Thomas Walker

Thomas Walker Last update: Oct 17, 2017

In Confluence versions 5.8 and later, Table of Contents macros are no longer rendered server-side anymore – meaning that we have to include a few resources in order to create a TOC.

In your head, include these resources:



For this to work, the script looks for all headings within an HTML element with the id "main-content". So make sure, that the element that wraps $page.content will have the ID.

<div id="main-content">

You can add the following style to clean up the clutter generated by the macro for Viewport.

  	.hidden-outline .toc-outline {
        display: none;
    .toc-outline {
        padding-right: .25em;
We use cookies to create a secure and effective browsing experience for our website visitors and to understand how you use our site (i.e. Google Analytics). For more information: click here.