Skip to end of metadata
Go to start of metadata

The Pagetree macro displays a dynamic, hierarchical list of pages starting from a specified parent (root) page. You can embed the page tree into your Confluence page, where it can act as a table of contents or a list of related topics.

When viewing the page tree, your reader can click a link to open the relevant page. The page's current position is highlighted in the page tree.

Below we tell you how to add the Pagetree macro to your page.

Creating a navigation panel for your space

The Pagetree macro is used in the Confluence Documentation theme, to create a navigation panel showing a table of contents for your space. Read the instructions on Configuring the Documentation Theme.

On this page:

Usage with the Macro Browser

To insert the Pagetree macro into a page using the Macro Browser,

  1. Open the Confluence page or blog post that you want to edit, then click the 'Edit' button.
  2. Click the Macro Browser icon on the toolbar. The macro browser window will open.
  3. Scroll through the list of macros to find the one you want. Alternatively, start typing the macro name into the search box at the top right of the macro browser. Macros with a matching name will appear in the main pane.
  4. Click the desired macro.
  5. Set the macro parameters to your requirements. If desired, you can preview these changes by clicking 'Refresh'.
  6. Click 'Insert' to add the macro onto the page.

(tick) You can also insert macros via autocomplete. For more information, see Using Autocomplete in the Rich Text Editor.

Once you've found the Pagetree macro and have added the required parameter values, click 'insert' to add it to your page.

Usage with the Wiki Markup Editor

Include the following markup in your page:

{pagetree}

There are more examples below.

Macro Parameters

Parameters are options that you can include in Confluence macros to control the content or format of the macro output. The table below lists relevant parameters for this macro.

Parameter names are different in the macro browser and in wiki markup. Below we show the macro browser parameter names in bold text, and the equivalent wiki markup parameters in (bracketed) text. If we do not show any parameter name for the wiki markup, then you should leave out the parameter name and simply include the parameter value as the first parameter, immediately after the colon (:).

Parameter

Required?

Default

Description

Include Excerpts in Page Tree
(excerpt)

no

false

Set this value to 'true' if you want the page tree to show excerpts from each page. The excerpts must be defined on each page by the Excerpt macro.

Show Expand/Collapse Links
(expandCollapseAll)

no

false

Set this value to 'true' if you want to display the 'expand all' and 'collapse all' links at the top of your page tree. Your readers can click these links to open or close all branches of the tree at once.

Reverse Order
(reverse)

no

false

Use this parameter in combination with the sort parameter described below. Set this value to 'true' if you want the pages displayed in descending order rather than ascending order.

Root Page
(root)

no

The home page of the space

Specify the parent page for the page tree. The tree will include all children of the given page, plus their children and grand-children etc. The tree will not include the root page itself.

Specify the page title or a special value as follows:

  • Your page title — Page tree shows all pages under the specified page.
  • '@home' — Page tree shows all pages under the home page of the space (default).
  • '@self' — Page tree shows all pages under the current page.
  • '@parent' — Page tree shows all pages under the parent of the current page, including the current page.
  • '@none' — Page tree shows all pages in the space, including orphaned pages and the home page.

Include Search Box above Page Tree
(searchBox)

no

false

Set this value to 'true' if you want to include a search box above the page tree. The search box allows your readers to enter a search term, and then searches within the page tree for the specified value.

Sort Pages By
(sort)

no

position

Specify the order to display the pages in the tree. This sort order is for display purposes only. It does not permanently re-arrange the page order. The value may be one of the following:

  • 'bitwise' — Display the pages using standard alphabetical sorting, such as: title1, title10, title2.
  • 'creation' — Display the pages in order of date created.
  • 'modified' — Display the pages in order of date last modified.
  • 'natural' — Display the pages in 'natural' alphabetical order, such as: title1, title2, title10.
  • 'position' — Display the pages using the default Confluence sorting rules. If your pages have been ordered manually, this sort will respect the defined order. Otherwise the pages will be displayed in the 'natural' alphabetical order, such as: title1, title2, title10.

Start Depth
(startDepth)

no

1

Enter any number greater than 0, indicating how many levels of children the tree should show when it opens for the first time.

Examples

All Parameters

Here's an example using all the parameters:

{pagetree:root=Page Name|sort=natural|excerpt=true|reverse=false|startDepth=3|expandCollapseAll=true|searchBox=true}

Specifying the Parent Page by Name

Use the following code to specify a page name for the parent or root of the tree. The tree will include all children and grand-children of the specified root. The tree will not include the specified root page itself.

What you need to type

What you will get

{pagetree:root=Pagetree Macro}

The above example is a 'live' example. It uses the child pages of this page to form the page tree.

Showing All Pages in the Space

Use the following code to make the page tree show all pages in the space, including orphaned pages and the home page.

{pagetree:root=@none}

Setting the Current Page as the Parent Page

What you need to type

What you will get

{pagetree:root=@self}

The above example is a 'live' example. It uses the child pages of this page to form the page tree.

Showing Excerpts from Each Page

Use the following code if you want your page tree to include excerpts from each page. The excerpts must be defined on each page by the Excerpt macro.

What you need to type

What you will get

{pagetree:root=@self|excerpt=true}

The above example is a 'live' example. It uses the child pages of this page to form the page tree.

Allowing your Readers to Expand or Collapse All Branches

Use the following code if you want to show the 'expand all' and 'collapse all' links at the top of your page tree.

What you need to type

What you will get

{pagetree:root=@self|expandCollapseAll=true}

The above example is a 'live' example. It uses the child pages of this page to form the page tree.

Including a Search Box

Use the following code if you want to include a search box at the top of your page tree.

What you need to type

What you will get

{pagetree:root=@self|searchBox=true}

The above example is a 'live' example. It uses the child pages of this page to form the page tree.

Sorting the Pages in Reverse Natural Order

Use the following code if you want to show the pages in reverse natural order.

What you need to type

What you will get

{pagetree:root=@self|sort=natural|reverse=true}

The above example is a 'live' example. It uses the child pages of this page to form the page tree.

RELATED TOPICS

Pagetree Search Macro
Adding a Navigation Sidebar
Working with Macros

Take me back to the Wikis Help Guide.

  • No labels