Is there an Exception Option for the Children Display Macro?
Asked by Jennifer Miller:

When editing the 'Children Display' macro there is not an edit option for excluding child pages I don't want listed based on the rules I set in the options. It would be a helpful addition to the edit options.

Thank you!


Answers:
author: jo llo
body: I also would like an exclude option for the children display macro. It is sometimes useful to display all the children of the current page's parent - all its siblings, and maybe its nieces and nephews. You can do that by naming the parent page in the children display macro, but the current page is included in the results, which is ugly.


author: Matteo Gubellini _SoftComply_
body: Hi,

I am by no means a developer, but this piece of code does exactly this. You can modify it to show the links too.

```
## @param noShowLabel:title=Label|type=string|desc=Label of pages to exclude

#macro(childrenList $parentPage)
#set($childpagesSub = $parentPage.getSortedChildren())
#set($childrenN = $childpagesSub.size())
#if($childrenN > 0)
<ul>
#foreach($page in $childpagesSub)
#set($noShow=0)
#set($pageLabels = $page.getLabels())
#foreach($pageLabel in $pageLabels)
#if($pageLabel == $paramnoShowLabel)
#set($noShow=1)
#end
#end
#if($noShow==0)
<li>$page.getTitle()</li>
#childrenList($page)
#end
#end
</ul>
#end
#end

#childrenList($content)
```

comments: author: Paula MEN?NDEZ
body: hello! how can i implemen this piece of code on a page? do i need. a macro? thanks


author: Kai Siren
body: \> I also would like an exclude option for the children display macro. It is sometimes useful to display all the children of the current page's parent - all its siblings, and maybe its nieces and nephews. You can do that by naming the parent page in the children display macro, but the current page is included in the results, which is ugly.

This is exactly the same thing I want!

I looked at the two feature request tickets, and the mechanisms and policies for upvoting were confusing. So I'm leaving my +1 here in the meantime.  

+1


author: Zak Laughton
body: Hi Jennifer!

Unfortunately, there's not a way to exclude child pages in either the [Children Display macro](https://confluence.atlassian.com/doc/children-display-macro-139501.html) or the [Page tree macro](https://confluence.atlassian.com/doc/page-tree-macro-163414255.html). The [Content by Label](https://confluence.atlassian.com/doc/content-by-label-macro-145566.html) and [Search Results](https://confluence.atlassian.com/doc/search-results-macro-139511.html) macros both return filtered lists of pages, and may work as alternative options (depending on your requirements).

I found a suggestion ticket for the functionality to exclude pages from the Children Display macro here: [CONFSERVER-43198](https://jira.atlassian.com/browse/CONFSERVER-43198). The ticket was closed by Product Management due to lack of activity, but you can still vote and comment on the ticket to give our developers more meaning surrounding the issue to possibly be fixed according to the [Implementation of New Features Policy](https://confluence.atlassian.com/support/implementation-of-new-features-policy-201294576.html).

Thanks!  
-Zak


Tags: child-page

macro