How to display flat list of descendant pages in confluence

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,

 

4 answers

1 accepted

This widget could not be displayed.
Davin Studer Community Champion Apr 20, 2015

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

Thanks for your help. That macro did the trick!.

Davin Studer Community Champion Apr 21, 2015

My pleasure.

Davin Studer Community Champion Apr 21, 2015

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.

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.

Davin Studer Community Champion Dec 07, 2015

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.

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.

Davin Studer Community Champion Dec 08, 2015

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.

This widget could not be displayed.

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.

This widget could not be displayed.

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.

This widget could not be displayed.

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

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 [ ] .

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Monday in Confluence

Why start from scratch? Introducing four new templates for Confluence Cloud

Hi my Community friends!  For those who don't know me, I'm a product marketer on the Confluence Cloud team - nice to meet you! For those of you who do, you know that I've been all up in your Co...

361 views 2 5
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you