Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to hide/display content based on macro output?

Avinash
Contributor
January 12, 2014

Hi,

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
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.
January 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:
if_children

Macro Title:
If Children

Macro Body Processing:
Rendered

Template:
## @noparams
#if ($action.page.children.size() > 0)
$body
#end

Avinash
Contributor
January 12, 2014

Thanks Davin!

0 votes
Andrei [errno]
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.
January 12, 2014

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
TAGS
atlassian, confluence whiteboards, whiteboard templates, template contest, visual collaboration, atlassian learning, confluence community, brainstorming tools, agile planning, team productivity, confluence templates, share your template

Share Your Confluence Whiteboard Template for a Chance to Be Featured in the Product! 🏆

Want to leave your mark on Confluence? One winner will have their whiteboard design added into Confluence for all users to access! This is your chance to showcase your creativity, help others, and gain recognition in the Confluence community.

Share your template today!
AUG Leaders

Atlassian Community Events