You can include a left-hand navigation sidebar (table of contents) in your Confluence space. There are two ways to do this:

  • (tick) Recommended: Use the Documentation Theme – The Documentation theme provides the left-hand navigation sidebar that you see in this documentation. Please go to the page that tells you how to configure the Documentation theme.
  • Customise the Space Layouts — This is an alternative method (documented below) that is more complex to set up than the Documentation theme and requires more maintenance with Confluence major release upgrades.
 

(warning) The information on this page does not apply to

Unable to render {include} The included page could not be found.
.

Notes to Read before you Start

Please take note of the following points before you use the method documented on this page:

  • Reapply customisation whenever you upgrade Confluence. Every time you upgrade Confluence, you must reapply the layout customisations described on this page. When you upgrade to a new major Confluence version (such as moving from Confluence 2.9.x to Confluence 2.10.x or from Confluence 3.0.x to Confluence 3.1.x) you will need to reapply the layout customisation. See instructions below.
  • Check your wiki permissions. To customise a space layout as described below, you must be a space administrator in the given space and you must be a system administrator on the Confluence site. See the overview of permissions and the glossary entries for space administrator and for Confluence administrator and system administrator.

Customising your Space Layouts to Add a Navigation Sidebar

Screenshot: A left-hand navigation bar resulting from customising the space layouts



Follow the instructions below to add the navigation sidebar to your Confluence space.

Step 1. Create the TreeNavigation Page

First, you will create a Confluence page containing the pagetree macro. This is just a normal Confluence page. The only slight oddity is that it should reside at the root of your space, instead of under the space's home page.

Follow these instructions:

  1. Go to the 'Space Pages' view for the current space. To do this:

    • Go to a page in the space and choose Browse > Pages.
    You are now at the 'root' level of your space. The 'root' level contains pages that are added above the space's home page, not as children of the home page.
  2. At the root level of the space, create a page named 'TreeNavigation'.
  3. On the page, insert the following text:

    {pagetree}
    
  4. Now decide if you want to add extra functionality to your page tree. By default, using the code above, the page tree will use the home page of the space as its root. You can choose to:
    • Specify a different root for your page tree.
    • Add a search box at the top of the tree.
    • Allow the viewers to expand and collapse the whole tree.
    • Control other aspects of the display.
      For more information, read about the Pagetree macro.

Step 2. Change the Space's Page Layout

Now you will change the space's page layout, to include the above page on the left of every web page displayed.

  1. Choose Browse > Space Admin.
    (info) Space Admin is displayed only if you are a space administrator for that space or you are a Confluence system administrator.

  2. Make sure the Confluence Default theme is selected from the Themes menu.
  3. Click Layout in the Look and Feel section.
    Note: The layout option is only displayed if you are a system administrator on the Confluence site.
  4. Click Create Custom in the Page Layout section.
  5. In the layout, locate the VIEW section, and find this code:

    <div class="wiki-content">
    $body
    </div>
    
  6. Replace the above code block with this code:

    #if ($action.isPrintableVersion() == false)
    <style>
    .spacetree * ul{
    padding-left:0px;
    margin-left: 0px;
    }
    .spacetree * li{
    margin-left: 5px;
    padding-left:5px;
    }
    
    </style>
    
    <table cellspacing="2" cellpadding="5">
    <tr>
    <td valign="top" align="left" width="22%" bgcolor="#F9F9F9" class="noprint">
    <div class="tabletitle">Table of Contents</div>
    <div class="spacetree">
    #includePage($helper.spaceKey "TreeNavigation")
    </div>
    </td>
    <td valign="top" align="left" width="78%" class="pagecontent">
    <div class="wiki-content">
    $body
    </div>
    </td>
    </tr>
    </table>
    #else
    <div class="wiki-content">
        $body
    </div>
    #end
    
  7. If you want to, you can change the table title in the above code from 'Table of Contents' to something else. For example, it might say 'Confluence Documentation'.
  8. Save the updated layout.

Reapplying the Customisation on Upgrade

When you upgrade to a new major Confluence version (e.g. from Confluence 2.9.x to Confluence 2.10.x or from Confluence 3.0.x to Confluence 3.1.x), you will need to reapply this customisation.

Reason:
The new Confluence version may contain updates to the space layouts. Because you have customised the space layouts, Confluence will not overwrite your customisation. So your space will not get the latest updates until you set the layout to default and then reapply your changes.

Here's how to do it:

  1. First make a copy of your customised code, if you have changed it from the code above:
    • Go to Space Admin, click Layout and edit the customised page layout (as created above).
    • Copy the section of code that inserts the customised left-hand navigation panel.
    • Close the page layout.
  2. Click Reset Default next to Page Layout, to set the page layout back to default. This will bring in the new code for the upgraded version of Confluence.
  3. Create a custom layout as described in step 2 above, and reinsert the custom left-hand navigation code.
  4. Save the updated layout.
RELATED TOPICS

Configuring the Documentation Theme
Customising Site and Space Layouts
Upgrading Customised Site and Space Layouts
Example Confluence Designs