Page Tree Macro

Add the Page Tree macro to a page to display all or part of the hierarchy of pages in a space.  

This macro is great for providing:

  • quick and easy navigation to pages about a specific project, if the pages are organised together under one parent page
  • a table of contents like experience to help people navigate a set of procedures
  • an overview of pages in the current part of the hierarchy in documentation spaces. 

On this page:

Screenshot: The Page Tree macro in Confluence showing two levels of hierarchy.


Add this macro to your page

To add the Page Tree macro to a page:

  1. From the editor toolbar, choose Insert > Other Macros.
  2. Choose Page Tree from the Confluence content category.
  3. Choose the number of page versions to display. 
  4. Choose Insert

You can then publish your page to see the macro in action. 

Screenshot: Configuring the Page Tree macro to display all pages below a specific page, in another space. 

Change the macro parameters

Macro parameters are used to change the behaviour of a macro.

To change the macro parameters:

  1. In the editor, click the macro placeholder and choose Edit.
  2. Update the parameters as required then choose Insert.

Here's a list of the parameters available in this macro. 

Parameter

Default

Description

Root Page
(root

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 — 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.
  • '@home' — will include all pages under the home page of the space (default).
  • '@self' — will include all pages under the current page.
  • '@parent' — will include all pages under the parent of the current page, including the current page.
  • '@none' — will include all pages in the space, including orphaned pages and the home page.
Restrict to this space keyCurrent space

Enter a space name to show the page tree for a different space. Leave blank to use the current space.

Set this parameter before the Root Page if you intend to specify a root page in another space.

Sort Pages By
(sort

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 — sort alphabetically, for example: title1, title10, title2.
  • creation — sort by date of creation.
  • modified — sort by order of date last modified.
  • natural — sort in 'natural' alphabetical order, for example: title1, title2, title10.
  • position — sort by 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.

Include Excerpts in Page Tree
(excerpt

false

Select if you want the page tree to show excerpts from each page. The excerpts must be defined on each page by the Excerpt macro.

Reverse Order
(reverse

false

Select to show the pages in reverse (descending) natural order. Must be used in combination with the Sort Pages By parameter.

Include Search Box above Page Tree
(searchBox

false

Select if you want to include a search box above the page tree. The search box allows your readers to search within the page tree for the specified value.

Show Expand/Collapse Links
(expandCollapseAll

false

Select 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.

Available values in wikimarkup and storage format:

  • true – Show the 'expand all' and 'collapse all' options.
  • false – Do not show the options.

Start Depth
(startDepth

1

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

Where the parameter name used in Confluence storage format or wikimarkup is different to the label used in the macro browser, it will be listed below in brackets (example).

Other ways to add this macro

Add this macro as you type

Type followed by the start of the macro name, to see a list of macros. 

Add this macro using wiki markup

This is useful when you want to add a macro outside the editor, for example as custom content in the sidebar, header or footer of a space.

Macro name: pagetree

Macro body: None.

{pagetree:root=Page Name|sort=natural|excerpt=true|reverse=false|startDepth=3|expandCollapseAll=true|searchBox=true}
Last modified on May 20, 2020

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.