I need to display a flat list of pages descendants of a page in confluence. The idea is to put this list at the top of a (home) page to show all of its descendants.
Page Tree and Children Display macros offer a hierarchy display only .
Any ideas?
Thanks in advance,
You could do this with a user macro and the children display macro. Create a user macro with the below velocity template. Set "Macro Body Processing" to "Rendered". Then on your page add the user macro and put the children display macro inside it.
## Developed by: Davin Studer ## Date created: 04/20/2015 ## @noparams #set( $id = $action.dateFormatter.calendar.timeInMillis ) <div id="children$id">$body</div> <style type="text/css"> #children$id .childpages-macro { padding: 0; margin: 0; } #children$id .childpages-macro li { display: inline-block; text-decoration: none; margin-right: 10px; } #children$id .childpages-macro li a::before { content: '['; } #children$id .childpages-macro li a::after { content: ']'; } </style>
Davin, Thanks for backing me up - I know how to use a lot of the existing macros but not how to create velocity templates. It appears you have supplied a reasonable solution. Hope it helps Adolfo. Cheers, Tom
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for your help. That macro did the trick!.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
My pleasure.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
One minor change would be to add remove the padding and margin on the .childpages-macro class so that the unordered list isn't indented from the content. I have edited the above user macro.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm also looking to do something similar as the original poster, but the macro above does not function in our instance running 5.8.15. Is there documentation somewhere that contains the calls being made by the macro to pull in the list of child pages? If I could pull in the list of child pages myself, I can format it as I like.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There are no API calls being made. You need to create the user macro with the above instructions. Then embed a children display macro inside of it. The user macro is simply using some css to reformat the embeded children display macro.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I realize that, but it fails to function in 5.8.15. I created the macro, added it to a page, included the Child Display macro inside the user macro, saved the page. Child Display shows as normal.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hmm. I've got a 5.5.6 and a 5.8.6 system and it works on both. My only guess would be that they changed some of the css classes in 5.8.15 such that my CSS above is not overriding the default layout.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Given that, have you tried either using the parameter's descendants depth at '1'?
For your needs I think the Children macro with 'Depth of Descendants' set at '1' would be best. Here is the same listing of children - utilizing the same parent page - for each macro (actual names of pages blurred out). The Children macro lists bullets, the Page Tree macro lists bullets AND clickable 'twisties' (they look like 'greater than' symbols) if there are pages under them.
Children macro screenshot -shows Depth of Descendants setting:
childrenmacro.png
Page tree macro screenshot - shows Start Depth setting:
pagetreemacro.png
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Right, but I need that list horizontal, not vertical. I don't see any options in the macros to do that. Each page should be between [ ] .
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, it's the children only. I need to display a page's children as a flat list, not a tree hirarchy. Reason for this is to include this list at the top of the page in a single row (I only use 5-6 children in my case). Macro Table of Contents allows flat list, but that only works for the headings inside a page, but the idea is the same.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Adolfo, are you asking for a display of only the first-level descendants ('children') vs. second-level ('grandchildren') and beyond, or an actual flat list with all descendant pages listed regardless of parent-child relationship? If the latter is what you want, do you need the pages to exist in the hierarchical position they were created in? If not, then of course you can easily move/drag them to be all direct children and thus use either macro can work.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.