{pagetree2} macro
This macro required Theme Builder 3 or above
Overview
Usage
{pagetree2:@space|selectionMode=node}
Parameters
| Parameter | Required | Default | Notes | Builder Version |
|---|---|---|---|---|
| default | @space | Defines where the page tree should start from:
|
3.0 | |
| space | current space | If you want to show a page tree for a different space, specify the space key of that space using this parameter. | 3.0 | |
| page | An alternate way to specify the page (by it's title) to use as the root node of the tree. | 3.0 | ||
| target | The target window that links in the tree should be opened in (eg. _blank or _self). | 3.0 | ||
| showIcons | true | Should icons be shown in the tree?
|
3.0 | |
| selectionMode | node | When a node is selected in the tree, what should be highlighted?
|
3.0 | |
| autoCollapse | false | Only allow a single node to be expanded?
|
3.0 | |
| indent | true | Should different levels of the tree be indented?
|
3.0 | |
| showRoot | true | Should the root node of the tree be shown?
|
3.0 | |
| branchStyle | plus-lines | Defines how the structure of the tree is visualised:
|
3.0 | |
| iconStyle | computer | Which icon set should be used?
|
3.0 | |
| class | An optional CSS class to assign to the outer wrapper of the page tree. | 3.0 | ||
| openpage | true | When a link is clicked, should the corresponding page be opened?
|
3.0 | |
| allowdrag | false | Allow pages in the tree to be dragged to new locations?
|
3.0 | |
| treename | The name of the tree (for use with pagepanel macro) |
3.0 | ||
| titletip | false | Should the page title be used as the tooltip when hovering over items in the tree?
|
3.0 | |
| initialDepth | 1 | Prevent the tree expanding beyond this depth on page startup. | 3.0 |
.png)








Comments (28)
Feb 10, 2010
Martin Barkanowitz says:
Hi all, {pagetree2} doesn't work, if the current space name contains " ...Hi all,
{pagetree2}doesn't work, if the current space name contains " characters. Example: space name = Space "XYZ".
Regards,
Martin
Aug 03, 2010
Rupert Shanks says:
Hi, Iam trying to get the pagetree to open by default to over 2 levels of child...Hi,
Iam trying to get the pagetree to open by default to over 2 levels of child pages. Here is the markup I am using
{builder-show:context=page,blogpost|mode=view} {div2:class=widget} {div:class=widget-title}*Navigator*{div} {pagetree2:@home|initialDepth=5|allowdrag=true} {div2} {builder-show}However it only opens to 1 child level by default and allowdrag doesnt work at all. Does anyone know what Im doing wrong?
P.S. Confluence 3.2.1 and Builder 4.0.1
Thanks
Aug 03, 2010
Alain Moran says:
Heh, you have misunderstood the initialDepth parameter .. it's not a counter to ...Heh, you have misunderstood the initialDepth parameter .. it's not a counter to force that depth, it's a counter to limit to that depth
So if you are 10 levels deep, the initialDepth parameter will limit the number of layers that are expanded to 5 - preventing 10 layers deep of information being retireved.
For the usage you are describing you probably want to be looking at the sorted-children macro (eg {sorted-children:@space|depth=5})
Aug 03, 2010
Rupert Shanks says:
Ok thanks Alain. I did realise it was meant to limit the amount of layers, but s...Ok thanks Alain. I did realise it was meant to limit the amount of layers, but surely something must be making them expand in the first place? How do you do that?
Aug 05, 2010
James Brown says:
How would I go inserting a dynamic parameter into the pagetree2 tag? Basically I...How would I go inserting a dynamic parameter into the pagetree2 tag? Basically I want it so that it always starts at the top level parent page. I am using this as part of a Theme Builder menu. So I want any pages that are using this template to have a pagetree that shows the toplevel parent.
So my structure might be something like this:
HR Space
So I am trying to build a pagetree that would be used in a template for the "Best Practices Wiki". So I want to insert a dynamic parameter into the tag that gets what the top level page is (in this case "Best Practices Wiki"). I don't want to hard code the page since I will be using this in a template and I will be using it for many different areas.
I assume the structure would be something like
So how do I insert the top level parent?Aug 06, 2010
Alain Moran says:
Depending on your perspective it's going to be one of {pagetree2:@space}, {page...Depending on your perspective it's going to be one of {pagetree2:@space}, {pagetree2:@home} or {pagetree2:@root}
Aug 06, 2010
James Brown says:
But wouldn't that include all pages in the whole space? That is not what I am lo...But wouldn't that include all pages in the whole space? That is not what I am looking to do. I want a pagetree that will include all pages that are contained within the top level parent. So If you look at my example structure if the pagetree was included on the page "Policy 3" or "Policy 2 Detail B", the outputted page tree would look something like:
Best Practices Wiki
Does that make sense? Maybe I am wording it incorrectly. I guess another way to say it would be that I want a menu with whatever the top level child page would be (since I suppose the top level parent could be considered the main space page).
Aug 08, 2010
Alain Moran says:
@root@root
Aug 09, 2010
James Brown says:
ah ok. yes, that did work. For some reason I was thinking that @root would inclu...ah ok. yes, that did work. For some reason I was thinking that @root would include everything in the entire space.
Aug 09, 2010
Alain Moran says:
The HTML documentation above was incorrect, I noticed it when you questioned my ...The HTML documentation above was incorrect, I noticed it when you questioned my answer so I updated it .. however you should use the confluence notation guide as your most authoritative source of info as it is updated at the same time as the code - the html docs tend to lag a bit :s
Aug 24, 2010
Rusty says:
I am able to get this macro to render fine on any of my pages, but I can't seem ...I am able to get this macro to render fine on any of my pages, but I can't seem to get it to work in the "sidebar" section of 3.3's default 'Documentation' theme. Any ideas? Instead of rendering, it spits out a bunch of javascript...
Aug 24, 2010
Alain Moran says:
That sounds like the pagetree macro is rendering correctly but the confluence do...That sounds like the pagetree macro is rendering correctly but the confluence documentation theme isn't able to cope with HTML in the sidebar ... you will need to contact Atlassian and get them to fix the documentation theme.
Aug 24, 2010
Rusty says:
Will do - thanks. I noticed that it rendered perfectly fine in a normal wiki pag...Will do - thanks. I noticed that it rendered perfectly fine in a normal wiki page, but when I try to add that same macro to the settings section of the documentation theme, it just spits out the javascript because it seems to be stripping the opening script tags: http://i.imgur.com/cvtd6.png
Aug 26, 2010
G D says:
for the life of me i cannot get the pagetree2 to sort manually rather then alpha...for the life of me i cannot get the pagetree2 to sort manually rather then alphabetically I have draged and changed the sorting by using > browse pages, where the sorting is correct under the tree heading.
in my LSB the code is
any help would be appericiated.
Oct 11, 2010
Bjorn Andersson says:
There is the list-spaces macro and the pagetree2 macro, what I'd really like to ...There is the list-spaces macro and the pagetree2 macro, what I'd really like to see is a combination of the two that will list
spaces
space pages
sub-spaces
sub-space pages
currently I see no way to build a space/page tree that has the root space at the top level with and sub-spaces and pages as children.
Oct 11, 2010
Alain Moran says:
Interesting idea, {pagetree2} isn't currently parent-space enabled ... I'll add ...Interesting idea, {pagetree2} isn't currently parent-space enabled ... I'll add the idea to our list of feature requests, but it's likely to be several months before we can look at adding it.
If you need this feature within a reasonable time-frame then you will need to request a quote for the work at http://tracker.adaptavist.com
Oct 11, 2010
Steeve Cayla says:
One way would be to use the {sql} (or {sql-query} for read-only queries) plugin,...One way would be to use the {sql} (or {sql-query} for read-only queries) plugin, find all the spaces and subspaces (I don't know how to find the relation between a space and a subspace but information might be somewhere in the database). Then, output the result as wiki markup.
You'll get something like that :
{sql-query:datasource=yourdatasource|output=wiki|table=false} SELECT '{pagetree2:space=' + s.spacekey + '}' FROM spaces s, (might be other tables too) WHERE .... (something that will find spaces and links between spaces and subspaces) {sql-query}This way, for each space, you'll get the pagetree macro showing all the pages inside, and if you manage to find the subspaces, you'll list pages the same way.
The code I gave is wrong, just the idea in order to help you.
There might also be an easier way to achieve what you're asking for, dunno.
Cheers.
Oct 12, 2010
Alain Moran says:
Sadly the metadata2 code only stores the parent space (as a content property btw...Sadly the metadata2 code only stores the parent space (as a content property btw), so builder (for compatibility with other metadata2 parent space plugins) also only stores this data (in the same place).
To get the child space lists in an efficient way you need access to the builder java api (it builds the tree structure and then caches it).
What's been asked for is definitely possible to achieve. It's just that, right now, we are booked out until at least the new year with paid-for work, and as more work comes in work on the free plugins will get pushed back.
Oct 27, 2010
Graham Bartlett says:
Is it possible to use custom icons in the pagetree? And, can I do it on a per-pa...Is it possible to use custom icons in the pagetree? And, can I do it on a per-page basis? How would I go about setting that up? Thanks!
Mar 01, 2011
Kaustubh Morankar says:
Hi there .. My requirement may be wierd but for one of the site we are building...Hi there ..
My requirement may be wierd but for one of the site we are building we require to sub-sections in the same page in page tree. i.e.
if my tree should look like below
- Home
- Page1
subsection1
and subsection1 and page1 will be pointing to the same page but at different location on the page. Is it possible using any other macros if not this ?
Thanks for the help.
Mar 01, 2011
Alain Moran says:
That would require development to achieve ... if you require a quote for the wor...That would require development to achieve ... if you require a quote for the work then please request it through the SALES project on tracker.adapatavist.com
Mar 22, 2011
Joseph Davis says:
Hello! I am using the pagetree2 macro and I'm trying to customize the CSS o...Hello!
I am using the pagetree2 macro and I'm trying to customize the CSS options. We have all of the customizations correct except the selected node does not remaine highlighted after the page loads.
How can I change the code in order to show what page is currently active
.atb-leftSidebar a:link, .atb-leftSidebar a:visited{ text-decoration: none; background-color: transparent; border:none; } .atb-leftSidebar a:hover, .atb-leftSidebar a.node:link:hover, .atb-leftSidebar a.node:visited:hover, .atb-leftSidebar a.prnnode:link:hover, .atb-leftSidebar a.prnnode:visited:hover{font-weight: bold; background-color: transparent;border:none;Any thoughts?
Thanks!!
Mar 22, 2011
Alain Moran says:
Have you heard of firebug, it allows you to click on an html element & see w...Have you heard of firebug, it allows you to click on an html element & see what classes are applied to it ... I find it invaluable in answering these kinds of questions.
In this case, try:
a.selprnnode { background-color:red !important;// or whatever you like really }Mar 22, 2011
Joseph Davis says:
That worked like a charm! However, the node that i'm on only highlights up until...That worked like a charm! However, the node that i'm on only highlights up until the 3rd child page. Do you know why that would be?
thanks for all your help!
Jun 24, 2011
Ing. Luboš Král says:
Just an idea, the existence of the parameter labels would be very useful ...Just an idea, the existence of the parameter labels would be very useful ...
Jun 24, 2011
Alain Moran says:
I assume you mean that it would be useful if you could specify a label & the...I assume you mean that it would be useful if you could specify a label & the tree only displays pages which have that label?
One question ... what happens when there are pages with the label but their parent pages do not?
Jun 24, 2011
Ing. Luboš Král says:
This is certainly a problem. Creating archive drawings. Drawings are divided acc...This is certainly a problem. Creating archive drawings. Drawings are divided according to reports. The drawing document are as descendants of the pages containing specific and additional information. This site has no descendants. To view the structure drawings is an ideal tree. Using the tree view and "ballast" contains documents that contain drawings ...
Jun 24, 2011
Alain Moran says:
If I understand you correctly you want to view a tree that contains only 'drawin...If I understand you correctly you want to view a tree that contains only 'drawings' but in the same structure as a more complicated tree which contains other data?
That's not going to be possible with the pagetree as it stands, however I do think that kind of navigation would be possible from a custom macro.
The custom macro would likely do all the grunt work of locating the pages with labels and tracing their parentage back to root in one pass & then dump the complete tree out as a set of nested lists. These lists could then be made active like the pagetree with some pretty basic JS.
However the initial search for pages will generate a significant load on your server in a space with lots of pages or if you have many users or slow authentication. This could be mitigated to some extent by using intelligent caching inside the macro, however in large spaces with many pages in the tree you are also looking at a significant increase in bandwidth usage since every page view would need to download the entire tree.