Community Central
Community Central
Table of Contents example

An example of table of contents

Any article with four or more headings will automatically generate a table of contents, henceforth abbreviated as a "TOC".

Changing the TOC in VisualEditor[]

In VisualEditor, click the "Settings ⚙️" icon, and click "Page Settings". It will show a popup similar to this:

VisualEditor editing TOC

The page settings menu showing the available states of showing the TOC.

  • Always - Shows the TOC all the time, even if there are fewer than 4 headings. This is the equivalent to __FORCETOC__.
  • If needed (Default) - Shows the table of contents if there are 4 or more headings.
  • Never - Hides the TOC, even if there are 4 or more headings. This is the equivalent of __NOTOC__.

Positioning the TOC[]

The TOC automatically appears just before the first heading. This can be changed in source editor by typing the magic word, "__TOC__" (with two underscores on each side of the word "TOC"). This will allow you to place it at a specific point on a page. Alternatively, "__TOC__" and "__FORCETOC__" can be used to force the TOC to show on a page with fewer than three headings.

Hiding the TOC[]

Type __NOTOC__ anywhere on a page to remove the TOC. This is often used for aesthetic reasons or on a community's main page.

Floating table[]

The TOC can be moved to a floating table on the right side by using the {{tocright}} template. This template exists on most wikis but can also be copied here.

A custom TOC[]

If you don't want the usual format of the TOC, you can disable the automatic TOC using __NOTOC__ and then add a manual TOC instead. This is often done to link to alphabetized sections. For example, if you want to link to 26 sections lettered A to Z, you can use a Compact TOC which is a special template used instead of the standard TOC.

You can copy the Compact TOC template here to your wiki if you want to use this. Here's how it looks:

Contents: Top - 0–9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z


Multiple TOCs on one page[]

If __TOC__ is used multiple times, only the first occurrence causes a TOC to appear. If you want extra ones, you will need to add them manually. This can be done by using a template such as CompactTOC.

Showing and hiding the TOC[]

You can click the show/hide link to expand or collapse the TOC. By default, logged in users will see the TOC while unregistered users will see the TOC collapsed. When you click show or hide, the wiki will save your preference and do the same on the next page you visit.

Sticky TOC[]

The table of contents is available anywhere on the page through a sticky button at the top left of the article page.

Sticky Table of Contents button

See also[]

Further help and feedback[]