Hey Community!
If I use the Page Tree macro, it will show ALL the pages under root space, I want it to only show Root Page and child-pages.
I know I can edit the macro itself but I cannot restrict the macro to one Root Page since I have it in my blueprint template.(Using the special values does not solve this problem either, @self @home @parent @none)
So my example goes:
Production(space)
When I'm on Creating(page), this shows in page-tree:
Creating(page)
Developing(page)
When I'm on How to develop(child page), this shows in page-tree:
Creating(page)
Developing(page)
When I'm on Creating(page), I want this to show in page-tree:
Creating(page)
When I'm on How to develop(child page), I want this to show in page-tree:
Developing(page)
I guess it's "just" a matter of creating a Page Tree Macro to only show Root Page and child-pages, but I cannot figure out how.
Does anyone have any clues?
Cheers,
André
Community moderators have prevented the ability to post new answers.
If you're comfortable with User Macros this is very easy to accomplish. https://confluence.atlassian.com/doc/writing-user-macros-4485.html
Example
image2016-8-5 13:17:12.png
Source
## Macro title: Children and Parent ## Macro has a body: N ## Body processing: No macro body ## ## Developed by: Steve Behnke ## Date created: 05/08/2016 ## Installed by: Your name here... ## ## This macro creates a unordered list of the current page and descendants. ## ## @noparams #set($currentPage = $pageManager.getPage($content.getId())) #set($childPages = $pageManager.getDescendants($currentPage)) <ul> <li> <a href="$currentPage.getUrlPath()">$currentPage.getDisplayTitle()</a> </li> <ul> #foreach ($childPage in $childPages) <li> <a href="$childPage.getUrlPath()">$childPage.getDisplayTitle()</a> </li> #end </ul> </ul>
Hey Steven Behnke!
Cheers for pitching in. (Sorry for the delay, I've been on vacation)
I can see two problems with this macro:
Also, is there a way to show all the parent pages except Space home-page? Not just the parent page of the current page. I know I can do this with:
$content.getParent().getTitle()
But I imagine I need something like this in the beginning:
$content.getAllParents('hide-space-home-page').getTitle()
ofc that's not working but maybe you see my point.
Cheers,
André
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I knew it wasn't too on-point, but I don't understand the requirements that great perhaps. I'll try to re-read your first post in light of your response and take another stab at this tonight (I like writing user macros, seems fun)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
How's it going mate, got any free time to look at my problem?
Cheers,
André
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for your input Rodney,
However this does not help anything but showing the children expanded from the start or not.
Cheers,
André
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
mm perhaps I don't understand the objective
so what is wrong with these three results - each uses "@self" and a depth of "1" but the Top page also includes the Expand/Collapse buttons
Top page
image2016-8-4 19:22:31.png
Creating Page
image2016-8-4 19:23:20.png
Developing Page
image2016-8-4 19:24:30.png
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rodney,
The problem is Creating(page) is only showing children, not itself.
Second problem is How to create(child) is not showing Parent page, and not showing it self or other children.
image2016-8-4 12:7:58.png
I want this to show in page-tree:
Creating(page)
image2016-8-4 12:8:28.png
I want this to show in page-tree:
Creating(page)
Cheers,
André
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
is this close? it is on the Creating page and shows itself and its "sister" page
image2016-8-4 20:16:29.png
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
or this with a starting depth of 2
image2016-8-4 20:17:57.png
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rodney,
No, sorry. You are just confirming my issues.
Changing start depth does neither hide or show other root page-links from the tree.
Creating(page) tree should only contain (start depth 2):
Creating(page)
How to create(child) tree should only contain (start depth 2):
Creating(page)
I do not believe this is achievable with the built in macro.
Cheers,
André
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes - it shows more than what you wanted but it does include what you wanted i.e. my settings of Page Tree macro on "Creating Page" shows:
I agree that to get specifically just what you want, you will need to develop your own macro or live with an oversupply of tree information
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Oh, I got the macro to display itself by, instead of typing @self, typing @ followed by starting to type the title of the parent page - it then pops up as a page selection
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rodney,
Yeah well this is my problem.
I don't want the oversupply of information about other pages that have nothing to do with the current page or it's children.
It shouldn't be rocket science but building more advanced custom macros is a real pain.
So I'm hoping someone else might pick up on this or send me in the right direction to someone who can.
Cheers,
André
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, this is true. But as I wrote in the ticket this is no solution, I cannot restrict the macro to one Root Page since I have it in my blueprint template.
And I cannot remove it, since removing it from the blueprint requires me to add a different Page Tree macro to all pages.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
and adding the expand/collapse buttons, root page as the title of the Parent page (Page Tree test) and start depth of 2
image2016-8-4 21:29:35.png
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Doh!!
How is this? It eliminates the oversupply of tree information
image2016-8-4 22:4:8.png
Use the "Children Display" macro, again setting the root page to the parent page name
image2016-8-4 22:5:35.png
As a standard macro if you copy it to another page it will be OK - except that you need to redefine the root page. It would be handy for your application if there was a command as "@parent" instead of "@self" so not quite a winner, but much closer
that is the best I can do ...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rodney,
Thanks for your effort to help me.
Yes I have played around with this as well, but it gives me the same issue about having to enter a specific page name as root - which wont do any good in a blueprint. As you say, a command like @parent or @rootparent would be excellent for this.
Too bad it's not possible in the current state of confluence.
Cheers,
André
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
well - it is now on their radar as an official feature improvement request
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.