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

This widget could not be displayed.
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
Community showcase
Posted Monday in Confluence

Why start from scratch? Introducing four new templates for Confluence Cloud

Hi my Community friends!  For those who don't know me, I'm a product marketer on the Confluence Cloud team - nice to meet you! For those of you who do, you know that I've been all up in your Co...

238 views 2 4
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