Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to display flat list of descendant pages in confluence

Adolfo Casari
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 20, 2015

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

2 votes
Answer accepted
Davin Studer
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 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>
TomC
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 21, 2015

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

Adolfo Casari
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 21, 2015

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

Davin Studer
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 21, 2015

My pleasure.

Davin Studer
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 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.

MarkC
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 7, 2015

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
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 7, 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.

MarkC
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 8, 2015

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
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 8, 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.

0 votes
TomC
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 20, 2015

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

Adolfo Casari
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 20, 2015

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

0 votes
Adolfo Casari
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 20, 2015

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.

0 votes
TomC
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 20, 2015

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.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events