How to use template variables in Content-by-Label and to label a page

I would like to have a page generated from a template automatically labeled with user-supplied input to a template variable.  I would also like to use that variable in Content-by-Label macros.  I'm using Confluence 5.7.   Is this possible?  

Thanks.

1 answer

1 accepted

0 vote
Davin Studer Community Champion Feb 05, 2015

If you create a user macro that implements the content by label macro then you could put you template variable inside the user macro body and have the user macro use the $body variable to populate the content by label macro inside the user macro. You could also create a user macro that will add a label to the page based on what is in the user macro body and put your template variable inside the user macro body.

Does that mean the user must type the label in the body form for each of the new macros I create? I tried this: ## @noparams <ac:macro ac:name="contentbylabel"> <ac:parameter ac:name="label">$body</ac:parameter> </ac:macro> This creates a form for the user to enter the label to display, but I can't get it to use a template variable for the label without requiring user input. I want to have a template variable that user input automatically substituted for the label. If I have a body parameter, doesn't that imply that user action is required?

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Kesha Thillainayagam
Posted Apr 13, 2018 in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

2,922 views 27 12
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