How to display flat list of descendant pages in confluence
Asked by Adolfo Casari:

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,


Answers:
author: Davin Studer
body: 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 )&lt;div id="children$id"&gt;$body&lt;/div&gt;&lt;style type="text/css"&gt;    #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: ']';    }&lt;/style&gt;
```

comments: author: TomC
body: 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


author: Adolfo Casari
body: Thanks for your help. That macro did the trick!.


author: Davin Studer
body: My pleasure.


author: Davin Studer
body: 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.


author: MarkC
body: 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.


author: Davin Studer
body: 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.


author: MarkC
body: 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.


author: Davin Studer
body: 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.


author: TomC
body: 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  
[](https://community.atlassian.com/t5/Confluence-questions/How-to-display-flat-list-of-descendant-pages-in-confluence/qaq-p/355677?attachment-id=9052){#link_119250c3aad572}  
[](/tnckb94959/attachments/tnckb94959/confluence-questions/60077/1/pagetreemacro.png){#display_119250c3aad572_0}  
[](https://community.atlassian.com/t5/Confluence-questions/How-to-display-flat-list-of-descendant-pages-in-confluence/qaq-p/355677?attachment-id=9053){#link_119250c3aad572_0}  
[](/tnckb94959/attachments/tnckb94959/confluence-questions/60077/2/childrenmacro.png){#display_119250c3aad572_2}

comments: author: Adolfo Casari
body: 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 \[ \] .


author: Adolfo Casari
body: 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.


author: TomC
body: 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.