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

Content by Label with Parent Page

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.
October 26, 2014

I found this answer (https://answers.atlassian.com/questions/3898), but it is now 3 years old and much has changed in Confluence in that time.

I have the immediate need to display a list of pages under a specific parent (not a space, but a parent page with numerous children) that contain a specific label. I have created user macros before, but I've nothing too fancy and nothing that uses an existing macro in which I try to expand its functionality.

Has anyone created a macro like this that you could share? Or can someone provide details on how to do what is talked about in the linked question above?

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Stephen Deutsch
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.
October 27, 2014

Hi Mark,

Here's something I whipped up, you could probably call it "descendants-with-label" or something like that:

## @param Label:title=Label|type=string|required=true|desc=Pages that contain this label should be displayed
<ul>
#foreach ( $descendant in $content.getDescendents() )
  #foreach ( $label in $descendant.getLabels() )
    #if ($label == $paramLabel)
      <li>#contentLink2($descendant, false, false)</li>
    #end
  #end
#end
</ul>

Just make sure you choose which label you want in the macro options and you should be good to go.

TAGS
AUG Leaders

Atlassian Community Events