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

Mark Morgan February 4, 2015

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 votes
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.
February 5, 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.

Mark Morgan February 6, 2015

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
TAGS
AUG Leaders

Atlassian Community Events