This page last changed on Aug 06, 2008 by smaddox.
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
A popular usage of the Pagetree macro is to create a navigation panel showing a table of contents for your space. Read the instructions on Adding a Navigation Sidebar. |
On this page:
Error formatting macro: toc: java.lang.NullPointerException
Using the Pagetree Macro
Include the following markup in your page:
There are more examples below.
Macro Parameters
Below is the full list of the parameters available.
Parameter |
Optional or Mandatory |
Default |
Description |
excerpt |
Optional |
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. |
expandCollapseAll |
Optional |
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 |
Optional |
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 |
Optional |
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.
|
searchBox |
Optional |
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 |
Optional |
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.
|
startDepth |
Optional |
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.
Setting the Current Page as the Parent Page
What you need to type |
What you will get |
|
|
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 Confluence User Guide
|