Confluence Docs 3.0 : Pagetree Macro This page last changed on Jun 03, 2009 by ggaskell. 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: Usage with the Macro Browser Usage with the Wiki Markup Editor Macro Parameters Examples All Parameters Specifying the Parent Page by Name Showing All Pages in the Space Setting the Current Page as the Parent Page Showing Excerpts from Each Page Allowing your Readers to Expand or Collapse All Branches Including a Search Box Sorting the Pages in Reverse Natural Order ## Usage with the Macro Browser To insert the Pagetree macro into a page using the Macro Browser, Open your desired Confluence page, then click the 'Edit' button. The 'Edit Page' mode opens. Next, click the Macro Browser icon on the editor toolbar. The Macro Browser will open in the middle of the screen. In the Macro Browser, type the name of your desired macro into the search box at the top right of the window. Macros with a matching name will appear in the centre pane. Click on the desired macro to see its options screen. Here, you can set the macro parameters then click 'insert' to put the macro into the page. 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 settings for Confluence macros that allow the user to control their content or presentation. The table below lists relevant parameters for this macro. Parameter names are displayed differently in the macro browser interface and in wiki markup. Below, parameter names used in the macro browser are indicated in Bold text, while their equivalents in wiki markup are indicated in (`bracketed`) text. If the latter is not shown, then in wiki markup, the parameter's name should be omitted and only its value should be added immediately after the colon symbol (`:`).
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}
| Collapse all Expand all Collapse all
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 Confluence User Guide.

Document generated by Confluence on Nov 05, 2009 23:35