Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Show only those Childpages that have a specific label

I'm looking for a way to display a list (ul & li structure in the result) of all childpages of a certain page, which have a certain label.
Actually a page tree would be enough for me, but even there I would like to filter for certain labels.
The attempt with the Reporting PlugIn was not very satisfying, because everything was very slow.

2 answers

0 votes
Bill Bailey Community Leader Oct 07, 2020

Wont the content-by-label-macro do the job? You can restrict on label and ancestor/parent.

Otherwise you can write a user macro. I built a child page by label macro based on this code: 

With the user macro, you have complete control over the formatting.

Hey, Bill,
thanks for your macro. It works so far. But unfortunately it only shows the first level of my childpages. And it also shows the content of the respective page.
What I'm looking for is the possibility to get all pages starting from a certain page with a certain label as a structured list. The result would be a HTML structure with many <ul> and <li> ;-)
Would this be possible with your macro?

Bill Bailey Community Leader Oct 08, 2020

The link I sent you was to a macro I reworked to develop what you describe: an unordered list (but sortable) of child pages that match a label. In looking at the code, it only does the first level. Let me put together an article with what I have done (it is limited to children -- need to think how to extended it to all decedents).

Stay tuned!

that would be great!!! I already had the idea that it would be enough to create a hierarchical PageTree of all subpages and then to include the labels of the subpages as a CSS class. Then it would be possible to hide certain CSS classes, which are the page labels, by CSS.
But I am curious if you have an idea for your macro for the other layers. Thanks in advance.

Bill Bailey Community Leader Oct 08, 2020

I have created an article that should really help you ;-)


Hey Bill,

thanks for the link. That's quite a bit. But as you write correctly, you now have to add the subpages of the subpages as a hierarchical tree. And my know-how for programming macros is also rather hobbyistic.

Will you stick to the matter? I have found a solution for all subpages of a certain page. But unfortunately all pages are displayed in one level. I haven't found a hierarchical page-tree user macro anywhere that you could build on.
But thanks again.

Hey Bill,

[I am also a  huge fan of user macros and would like to learn ;o)]

I followed the link and saw it was tagged for the server version.  Is there any reason why your macro would not work in the Cloud version?

0 votes
Tessa Tuteleers Community Leader Oct 07, 2020

Hi @Christian Jurasz-Kischka , 

I'm trying to understand your question. 

If you have a list of items, containing parents and children like a pagetree, and filter out only pages with a certain label, how would your tree handle this? 

Say your page has a child that does not have the label you are filtering on, but a child of thát page does have the label, your tree would break, no? 

I think that's why the label filtering macro only shows a flat list of pages instead of a tree. 
Please let me know if I understood incorrect and I'll see if we can figure something else out! 


That is certainly true, that the described situation could be a problem.

But an idea would be, that the system only looks for labels in the subpages, if the mother page has the corresponding label.

Alternatively you could of course say that all pages are shown in the hierarchy if only one subpage has the label.

But for my problem I can make sure that there is always a continuous path for the pages ;-)

Another idea would be to get all subpages of a page as an unnumbered list (ul - li) and to write the labels as a class into the HTML code. Using CSS you would then simply hide one or the other entry based on the label (as a CSS class).
But: Who can give me a hint on how to implement this as a macro ;-)

Suggest an answer

Log in or Sign up to answer

Atlassian Community Events