cogGenerates a Table Of Content for titles (headings)
Developed by

XWiki Development Team

0 Votes
LicenseGNU Lesser General Public License 2.1
Bundled With

XWiki Standard

Installable with the Extension Manager


Each title has an anchor associated to it.


From WYSIWYG Editor


From Wiki Syntax

{{toc start=2 depth=6 numbered=false scope=page /}}

Parameters definition

NameOptionalAllowed valuesDefault valueDescription
startyes1 - 61an initial level where the TOC generation should start at
depthyes1 - 66maximum level the TOC is generated for
numberedyestrue/falsefalseif should generate numbering for titles (see examples below)
scopeyespage/localpageIf local, only section in the current scope will be listed. For example if the macro is written in a section, only subsections of this section will be listed. Not used if a reference is specified (since in this case the scope is always page)
referenceyesReference to a pageCurrent pageThe page for which to generate the TOC for. If not specified, generate a TOC for the current page. Since 9.6RC1

Heading numbering in TOC

The Numbered Headings Application offers a TOC macro that overrides the default one and adds numbering.


14.10+ The root list element of the TOC macro has the class wikitoc which can be targeted with CSS to style the TOC macro, e.g., in a skin extension.


Example 1: Simple

{{toc /}}

= Level 1


== Level 2



Example 2: Floating

{{box cssClass="floatinginfobox" title="**Contents**"}}{{toc/}}{{/box}}

= Level 1


== Level 2



Example 3: Different numbering of sub lists

With a bit of CSS you can change the numbering of subitems. For example add a StyleSheetExtension Object to your page and put the following content (select Always on this page):

ol { list-style-type: none; counter-reset: say; }
ol li:before { counter-increment: say; content: counters(say,".") ". "; }

With this extension, the following content will have, for example, Level 2 displayed as 1.1 (see Result below):

{{toc numbered="true"/}}

= Level 1
== Level 2
== Level 3
= Level 4
== Level 5



Prerequisites & Installation Instructions

We recommend using the Extension Manager to install this extension (Make sure that the text "Installable with the Extension Manager" is displayed at the top right location on this page to know if this extension can be installed with the Extension Manager).

You can also use the manual method which involves dropping the JAR file and all its dependencies into the WEB-INF/lib folder and restarting XWiki.


Dependencies for this extension (org.xwiki.rendering:xwiki-rendering-macro-toc 14.9):


Get Connected