TOC on every page by default

Wanted to add this capability for those out there looking to unify page layouts within a space:

Goal here was to have a table of contents on every page in a given space, but this could be used to render any macro on pages in a given space.

* Navigate to a space, Browse > Space Admin

* In the Look & Feel Section > Layouts

* Page Layouts > Create custom

In velocity templates, you can call a Confluence macro using notation like this:

$helper.renderConfluenceMacro("{toc}")

Depending on where you want this to render determines where you place it. In my case, I wanted the toc to render above the main content section, so I put this after the metadata section but above the main-content section.

Hope this helps!

3 answers

1 accepted

answered to close this out.

This might be a good "how to" article in the Confluence Knowledge Base space too.

But it doesn't work if you try to add it to all pages, see bug https://jira.atlassian.com/browse/CONF-14004

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Asked May 24, 2018 in Confluence

What are the resources that you use to learn more about Atlassian Products?

I am gathering information about resources available for Atlassian product knowledge transferring for a presentation in our local Atlassian User Group. I want to group them in four categories From ...

602 views 18 16
View question

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you