How to hide/display content based on macro output?


I'm having a section in my confluence page to display child pages. I want to display that section only if the macro {children} retrives any child pages. I'm not sure how to use the excerpt macro to get this result. Any help greatly appreciated.

Thanks in advance!

2 answers

1 accepted

1 vote
Accepted answer
Davin Studer Community Champion Jan 12, 2014

You can do this pretty easily with a uer macro. Here is the code. This will create a user macro that you can wrap around the conditional content. If there are children to the page then that section will show, otherwise it will not.

Macro Name:

Macro Title:
If Children

Macro Body Processing:

## @noparams
#if ($ > 0)

Thanks Davin!

I can only suggest tinkering with user macro + some velocity code.
Not sure how excerpts macro will help you.

also - referencing your Confluence version might be helpful

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Feb 06, 2019 in Confluence

Try out the new editing experience

Hi team, I’m Avinoam, a product manager on Confluence Cloud, and today I’m really excited to let the Community know that all customers can now try out the new editing experience and see some of the ...

1,376 views 100 8
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you