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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jul 10, 2018 in Confluence

We want to see the templates you've created in Confluence!

Hi Community, Jessica here from the Confluence Product Marketing team!  July’s community challenge is all about sharing pictures  — and as an extension of our first post on what ...

907 views 23 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