The {pagetree} macro, is used for displaying a tree view of the page hierarchy.
The {pagetree} macro displays a tree view of the hierarchy of pages using a user-definable page as its root. It can display both the page title and any excerpt that is inside the page. The tree entries can be sorted by title, creation or modification date and may also be reversed.
Parameters:
The {pagetree} macro parameters define the way that the entries are sorted, whether the excerpt should be included or not and the page that is to be the root of the tree.
{pagetree:root=myPage|excerpt=true}
Parameter
Required
Default
Notes
root
Space Homepage
The page from which the tree view will start (ie. it's first "root" node). This setting defaults to the Space Homepage (as defined in Space Admin) but can also be:
any page title — the title of a page to use as the root node
@self — the current page
@parent — the parent page for the current page being viewed
excerpt
false
Whether excerpts should be displayed or not
sort
natural
The order in which pages should be sorted, this parameter can take one of four values
natural — Natural sort order is the order that most people would expect, ie 'title 10' comes after 'title 2'
bitwise — Bitwise sorting is confluence's default mode of sorting, using this algorithm 'title 10' comes before 'title 2' since '1' is less than '2' (the zero never gets considered)
creation — Sorts the pages in the order that they were created
modified — Sorts the pages in the order of their last modification date
reverse
false
Setting this parameter to true will reverse the order of sorting
Examples:
Basic Usage
To display a tree starting with the space home page, use the macro as follows:
{pagetree}
Which results in:
To display the tree starting from a specific page, use the root parameter as follows:
{pagetree:root=Macros}
Which produces the following output:
You can also specify the root page as "@self" for the current page or "@parent" for the parent of the current page.
Displaying page excerpts
Excerpts embedded into pages may be displayed alongside the link to the page by setting the excerpt flag to true
{pagetree:root=Navigation and Lists|excerpt=true}
Which looks like this:
Bitwise sort order
Bitwise sorting simply takes each character of the title and compares it with the next title in order to decide which should be displayed first. This is the simplest kind of sorting, and is used by confluence in most places.
{pagetree:root=pagetree macro|sort=bitwise}
Which looks like this:
Natural sort order
Bitwise sorting works very well in most cases however when your title contains a number of some kind it starts to break down. A bitwise sort will think that 'title 10' should come after 'title 1' but before 'title 2', since when the bitwise sort gets to the first digit in 'title 10' it doesn't understand that the zero should also be taken into account.
Natural sorting is very similar to bitwise sorting, however as the two titles are being compared the algorithm checks to see if the characters it is comparing are numbers or not. If they are numbers then it works along the title until it finds something that isn't a number and then uses the whole number value to compare against the other title.
Since this method of sorting produces more reliable results than the standard bitwise sort used elsewhere in confluence, it has been chosen as the default sort method for the {pagetree} macro
{pagetree:root=pagetree macro}
Which looks like this:
Creation Date sort order
There may be occasions when you need to sort by the date that the page was created (first to last / oldest to newest), to do this you set the sort algorithm to 'creation' as can be seen below.
{pagetree:root=pagetree macro|sort=creation}
Which looks like this:
Modification Date sort order
There may be occasions when you need to sort by the date that the page was last modified (first to last / oldest to newest), to do this you set the sort aglorithm to 'modified' as can be seen below.
{pagetree:root=pagetree macro|sort=modified}
Which looks like this:
Reversing the sort order
You can also display any of the sort orders in reverse order by setting the reverse parameter to true
{pagetree:root=pagetree macro|reverse=true}
Which produces a reverse-alphabetical sort as can be seen below:
Reverse sorting however may be more useful when used in conjunction with the modification or creation date sorting, for example the following code produces the pagetree with the most recently modified page at the top.
Would it be possible to add some options to pretty up some of the formatting whe...
Would it be possible to add some options to pretty up some of the formatting when excerpts are displayed? I neet to turn it on, but we have excerpts that have muliple lines and the pagetree macro displays these lines left justified under the node. Maybe even just indenting to the top line of the excerpt would look better. Thoughts?
It's a little odd that using root=@parent doesn't show the actual root page. If...
It's a little odd that using root=@parent doesn't show the actual root page. If you want to, in effect, show how the current page fits into a larger structure (i.e., as the child of the parent, along with the siblings and the page's children), you have to show the entire structure.
root=@self similarly only shows children, which is great if you've labeled something "here are the children" but confusing if you haven't and useless if there are no children.
It would be more helpful if @parent showed the parent and the children, etc., of the parent.
Anyway of modifying this macro to allow other parameters like "showroot=true"?
Yeah, could you pleeeez add a parameter like "showroot=true".
We use this macr...
Yeah, could you pleeeez add a parameter like "showroot=true".
We use this macro for the left navigation in all of our spaces (~200). In most cases we just use root=@none (wich conveniently shows all pages in the space). But sometimes we want to use an individual page as the root.
Without showing the root page as part of the tree you lose the relational page structure.
Is there a way to display the pagetree in collapsed mode when a user goes to a c...
Is there a way to display the pagetree in collapsed mode when a user goes to a certain page, rather than the pagetree expand to show where the page is in the structure?
Hi,
is it possible to change the information displayed in the tooltip of a menu...
Hi,
is it possible to change the information displayed in the tooltip of a menu item? At the moment the tooltip shows the information about the last change of the page. I would like to show which the submenus are included.
So the user can quickly check which submenus exist without expanding a menu.
Comments (8)
Apr 06, 2006
Anonymous says:
Would it be possible to add some options to pretty up some of the formatting whe...Would it be possible to add some options to pretty up some of the formatting when excerpts are displayed? I neet to turn it on, but we have excerpts that have muliple lines and the pagetree macro displays these lines left justified under the node. Maybe even just indenting to the top line of the excerpt would look better. Thoughts?
Jul 21, 2006
Anonymous says:
It's a little odd that using root=@parent doesn't show the actual root page. If...It's a little odd that using root=@parent doesn't show the actual root page. If you want to, in effect, show how the current page fits into a larger structure (i.e., as the child of the parent, along with the siblings and the page's children), you have to show the entire structure.
root=@self similarly only shows children, which is great if you've labeled something "here are the children" but confusing if you haven't and useless if there are no children.
It would be more helpful if @parent showed the parent and the children, etc., of the parent.
Anyway of modifying this macro to allow other parameters like "showroot=true"?
Charlie at ETR Associates
Apr 12, 2011
Dhyana Scarano says:
Yeah, could you pleeeez add a parameter like "showroot=true". We use this macr...Yeah, could you pleeeez add a parameter like "showroot=true".
We use this macro for the left navigation in all of our spaces (~200). In most cases we just use root=@none (wich conveniently shows all pages in the space). But sometimes we want to use an individual page as the root.
Without showing the root page as part of the tree you lose the relational page structure.
Please, please, please
Sep 29, 2006
Anonymous says:
We need a version of this plugin that lists all the pages inside a space, not ju...We need a version of this plugin that lists all the pages inside a space, not just those grouped under the space home page.
Cheers,
Kalle Hallivuori
Sulake Corporation Oy
Oct 27, 2006
Anonymous says:
Yes, we need this too please.Yes, we need this too please.
Oct 27, 2006
Guy Fraser says:
It would probably be better to just link to the Space Tree View which you can do...It would probably be better to just link to the Space Tree View which you can do with the menulink macro or the link-to macro
Jul 09, 2010
Wayne Parker says:
Is there a way to display the pagetree in collapsed mode when a user goes to a c...Is there a way to display the pagetree in collapsed mode when a user goes to a certain page, rather than the pagetree expand to show where the page is in the structure?
Nov 09, 2010
Benjamin Walther says:
Hi, is it possible to change the information displayed in the tooltip of a menu...Hi,
is it possible to change the information displayed in the tooltip of a menu item? At the moment the tooltip shows the information about the last change of the page. I would like to show which the submenus are included.
So the user can quickly check which submenus exist without expanding a menu.
Thanks,
Ben