This documentation is deprecated. Adaptavist's documentation has moved to a new location where it is maintained and updated. Please visit Adaptavist's new Documentation area.
add-label macro
Overview:
The {add-label} macro allows you to add one or more labels to a page automatically.
The macro is designed to be used in templates, scaffolds and other automatically generated content where there is a need to ensure that one or more labels are always added.
Parameters:
To define a label to be added anywhere within your content, use the following notation:
{add-label:label1,label2,label3}
Examples:
Basic Use:
To add a single label to a page use the following format:
{add-label:testlabel1}
Note that nothing will be output. If the label already exists, no action will be taken.
You will see the label in the list at the top of the page and can also display labels using the page-info macro as shown below:
I'm using this add-label macro in a Global Template and filling in the label inf...
I'm using this add-label macro in a Global Template and filling in the label information using a variable. When the template is used the folowing exception is reported in the Fill in template variables page.
Error formatting macro: add-label: java.lang.IllegalStateException: Content must be persistent before it can be labelled.
Thing is...this actually works and is extremely useful for us in setting up testcase pages using the meta-data plugins. Is there any way this exception could be suppressed? Right now, we just tell users to ignore it when creating a Testcase page based on our Testcase Template and everything works great! Just would be nice if we didn't have to explain that this exception can be ignored.
Curiously, I'm seeing the opposite behavior. When in a Global Template I provid...
Curiously, I'm seeing the opposite behavior. When in a Global Template I provide the add-label macro with string literals (i.e. text) I get the error message you describe at the moment I actually use the template. However, if I use (VAR) type (built-in form field) variables in the add-label macro I get no error messages from the macro at any point in the page generation process. This is a great macro!
Maybe a great addition would be to also make it the other way around
{remove-...
Maybe a great addition would be to also make it the other way around
{remove-label:alabel}
{remove-labels}
Because if i have added a label with scaffolding to a page (select option a --> labela) and on second thought i would like to edit the page and select option b --> add-label labelb it still containts labela
Just curious. Is there anyway to automatically add labels to a news post when it...
Just curious. Is there anyway to automatically add labels to a news post when it is created? I want to use the blog post macro in a space to collect only a specific type of news item as indicated by a label. I realize I can have people add the label themselves, but I would really like to cut out the middle man.
Were you able to get an answer on this? I am trying to set the labels to a news ...
Were you able to get an answer on this? I am trying to set the labels to a news post or pages that are created from a parent page. I have not been able to find a way to do this.
I love the add-label macro, but some of our folks would like to have the templat...
I love the add-label macro, but some of our folks would like to have the template prompt users to choose a label from a list. I had hoped that I could combine the add-label macro with the form markup used in templates like this, but it doesn't work:
Of course, we want the outcome to be a list of labels like "solution, motorola, coverage" so that people could search for content of type 'solution' for the 'Motorola' customer that addresses the 'coverage' subject matter.
Is there a workaround or alternative for this use model that I can try instead? Does anyone else want to choose labels from a predetermined list?
Hello
Great macro to get paged labeled automatically...but I desparetly try to g...
Hello
Great macro to get paged labeled automatically...but I desparetly try to get the value from a scaffold live-template list-data and can't get it to work...
No - it's a problem with scaffold plugin and the latest confluence (2.5 and abov...
No - it's a problem with scaffold plugin and the latest confluence (2.5 and above I think). Please check with the author of the scaffold plugin for more info.
This is the script we are currently using. This works well but so far (is it me?...
This is the script we are currently using. This works well but so far (is it me?) it will only work with one variable at a time. In the above example the variable is Type. If from another field we had a variable that the user generated on creating the page called Size I find that amending the above code to read:
Hi,
im using add-label macro.
Is there any way that only the certain group of p...
Hi,
im using add-label macro.
Is there any way that only the certain group of people can both edit and view
the label. while other group of people can only view the label.
I ended up using this code to get accomplished what I want - it creates a "Tag T...
I ended up using this code to get accomplished what I want - it creates a "Tag This Page" link that labels the page with the user's username as the Label. I would prefer a JavaScript drop-down menu, but this is sufficient for my company's current needs, and it works with 2.9. I added it to page.vmd at the top of the page.
The window.location.reload is just to make the page refresh and update the Labels. I wish I had more time to get the Actual JS update code, but it was too hard (for me) to get working...
<a href="#" onclick="AddLabelToEntity.addLabel(AJS.params.pageId,'$generalUtil.htmlEncode($user.name)'); window.location.reload();"
style="font-size: 15px; font-weight: normal; float: right;">
Tag This Page</a>
I am using Confluence 2.9.2, I can't add labels which have whitespace in them, s...
I am using Confluence 2.9.2, I can't add labels which have whitespace in them, such as "test1 test2" " withe space".
I use the add-label macro like this:
{add-label:test1 test2}
{add-label:white space}
Is this a bug? Is there anyway to add such kind of labels by using add-lable macro?How can I solve this problem?
Any help or suggestion will be appreciated.
labels cannot have whitespace (and some other prohibited chars) in them. I found...
labels cannot have whitespace (and some other prohibited chars) in them. I found somewhere a usermacro called safelabel or similar that filtered out invalid label chars and delivered a clean label, safe to add.
The template that is used to create new pages in our Wiki has some variables tha...
The template that is used to create new pages in our Wiki has some variables that I would like to have also saved as labels for that page. I have used add-label and been happy with the result for hard-coded labels but I can't get it to work with my new idea. I saw some other references in this thread discussing dynamic labels. Currently we are trying a variation based on replace-and-render but it quite bulky. What I would like to be able to do is:
where variable name is from the populated from elsewhere in the page.
Comments (28)
Apr 12, 2006
Anonymous says:
Is it possible to add the support of adding dynamic content to label? a example...Is it possible to add the support of adding dynamic content to label?
a example will be {add-label:{pageid}} in which the macro
will generate the page id for that page. It will be very useful for us if it's possible. Thanks
Feb 19, 2007
eric@jax.org says:
I second this request. I need {add-label:{metadata-from:Random Page|randomValue...I second this request. I need {add-label:{metadata-from:Random Page|randomValue}}...
Thanks for considering it!
Jun 08, 2006
Anonymous says:
I'm using this add-label macro in a Global Template and filling in the label inf...I'm using this add-label macro in a Global Template and filling in the label information using a variable. When the template is used the folowing exception is reported in the Fill in template variables page.
Error formatting macro: add-label: java.lang.IllegalStateException: Content must be persistent before it can be labelled.
Thing is...this actually works and is extremely useful for us in setting up testcase pages using the meta-data plugins. Is there any way this exception could be suppressed? Right now, we just tell users to ignore it when creating a Testcase page based on our Testcase Template and everything works great! Just would be nice if we didn't have to explain that this exception can be ignored.
Jun 17, 2006
Anonymous says:
Curiously, I'm seeing the opposite behavior. When in a Global Template I provid...Curiously, I'm seeing the opposite behavior. When in a Global Template I provide the add-label macro with string literals (i.e. text) I get the error message you describe at the moment I actually use the template. However, if I use (VAR) type (built-in form field) variables in the add-label macro I get no error messages from the macro at any point in the page generation process. This is a great macro!
Jul 17, 2006
Anonymous says:
I fixed this by the way in the 1.1. release of the labeltools plugin. Kelsey Gr...I fixed this by the way in the 1.1. release of the labeltools plugin.
Kelsey Grant
Jul 25, 2006
Anonymous says:
The plugin seems to be broken on this page.The plugin seems to be broken on this page.
Oct 25, 2006
Anonymous says:
Maybe a great addition would be to also make it the other way around {remove-...Maybe a great addition would be to also make it the other way around
{remove-label:alabel} {remove-labels}Because if i have added a label with scaffolding to a page (select option a --> labela) and on second thought i would like to edit the page and select option b --> add-label labelb it still containts labela
Jan 17, 2007
Anonymous says:
Hi there, I'm using the 1.1. version of the labeltools plugin, and when I try t...Hi there,
I'm using the 1.1. version of the labeltools plugin, and when I try to use the macro, I get:
Error formatting macro: add-label: java.lang.NullPointerException
Is this a bug?
Thanks
Alex.
Jun 28, 2007
karen lai says:
Hi, We're getting the same error. Did you have any luck figuring it out?Hi,
We're getting the same error. Did you have any luck figuring it out?
Jan 19, 2007
Anonymous says:
Just curious. Is there anyway to automatically add labels to a news post when it...Just curious. Is there anyway to automatically add labels to a news post when it is created? I want to use the blog post macro in a space to collect only a specific type of news item as indicated by a label. I realize I can have people add the label themselves, but I would really like to cut out the middle man.
Mar 12, 2008
Jose Biton says:
Were you able to get an answer on this? I am trying to set the labels to a news ...Were you able to get an answer on this? I am trying to set the labels to a news post or pages that are created from a parent page. I have not been able to find a way to do this.
Apr 24, 2008
Reese Vanselow says:
Looks like the following will help with this issue. http://confluence.atlassi...Looks like the following will help with this issue.
http://confluence.atlassian.com/display/CONFEXT/Automatically+label+news+post
Don't know how to get dynamic content for the label to work. Does anyone else?
Jun 12, 2007
Carrie Moley says:
I love the add-label macro, but some of our folks would like to have the templat...I love the add-label macro, but some of our folks would like to have the template prompt users to choose a label from a list. I had hoped that I could combine the add-label macro with the form markup used in templates like this, but it doesn't work:
{add-label:solution,@customer|list(motorola,hp,sun)@,@category|list(constraints,assertions,debug,lrm_support,coverage,language)@}
Of course, we want the outcome to be a list of labels like "solution, motorola, coverage" so that people could search for content of type 'solution' for the 'Motorola' customer that addresses the 'coverage' subject matter.
Is there a workaround or alternative for this use model that I can try instead? Does anyone else want to choose labels from a predetermined list?
Thanks,
Carrie
Jul 15, 2008
Crystal Johnson says:
I would like to be able to have users promted to choose from a list of labels. H...I would like to be able to have users promted to choose from a list of labels. Has there been any additional info on this suggestion?
Oct 21, 2010
heather says:
me toome too
Aug 17, 2007
Serge Wargnies says:
Hello Great macro to get paged labeled automatically...but I desparetly try to g...Hello
Great macro to get paged labeled automatically...but I desparetly try to get the value from a scaffold live-template list-data and can't get it to work...
{list-data:Type|type=check|multiple=false|required=true} {list-option}Website{list-option} {list-option}Application{list-option} {list-option}Other{list-option} {list-data} ... ... {add-label:{list-data:Type}}Any idea where I am wrong?
Thanks in advance
Serge
Aug 27, 2007
Christopher Christophorou says:
Hi, We have the same problem. For some reason live-template: No template named...Hi,
We have the same problem. For some reason
does not seem to work, and right now we can't use any templates.
Is the theme builder incompatible with the Scaffold macro?
We are using the latest version of both theme builder and Confluence.
Thanks,
Chris
Aug 28, 2007
Guy Fraser says:
No - it's a problem with scaffold plugin and the latest confluence (2.5 and abov...No - it's a problem with scaffold plugin and the latest confluence (2.5 and above I think). Please check with the author of the scaffold plugin for more info.
Aug 29, 2007
Serge Wargnies says:
Hi, Here a solution that as its author said is maybe not the most efficient but ...Hi,
Here a solution that as its author said is maybe not the most efficient but it works.
So I tried
And to get the add-label working...I was told to use replace-and-render...and the result looks like:
Hope this will help others.
Thanks anyway
Cheers
Aug 24, 2010
Chris Mears says:
This is the script we are currently using. This works well but so far (is it me?...This is the script we are currently using. This works well but so far (is it me?) it will only work with one variable at a time. In the above example the variable is Type. If from another field we had a variable that the user generated on creating the page called Size I find that amending the above code to read:
get-data:Type,Size
Doesn't work. Any ideas?
Thanks again
/c
Dec 19, 2007
Dhivya Manoharan says:
Hi, im using add-label macro. Is there any way that only the certain group of p...Hi,
im using add-label macro.
Is there any way that only the certain group of people can both edit and view
the label. while other group of people can only view the label.
With Regards,
Dhivya.M
Sep 04, 2008
Aaron T says:
Confluence 2.9 The add-label macro works, but the choose-label macro does not s...Confluence 2.9
The add-label macro works, but the choose-label macro does not seem to add the labels when I click on the links. Here is my wiki markup
{choose-label:labels=test|title=Please Choose...|descriptions=test} {choose-label}Sep 07, 2008
ian mccrae says:
I am having the same problem with Confluence 2.9 and the Choose Label macro...an...I am having the same problem with Confluence 2.9 and the Choose Label macro...and my markup is
{choose-label:labels=orange,red,blue|title=Please Choose...|descriptions=An Orange,A Deep Red,An Ocean Blue}In previous versions this macro worked fine!
Sep 08, 2008
Aaron T says:
I ended up using this code to get accomplished what I want - it creates a "Tag T...I ended up using this code to get accomplished what I want - it creates a "Tag This Page" link that labels the page with the user's username as the Label. I would prefer a JavaScript drop-down menu, but this is sufficient for my company's current needs, and it works with 2.9. I added it to page.vmd at the top of the page.
The window.location.reload is just to make the page refresh and update the Labels. I wish I had more time to get the Actual JS update code, but it was too hard (for me) to get working...
Nov 11, 2008
nathan says:
I am using Confluence 2.9.2, I can't add labels which have whitespace in them, s...I am using Confluence 2.9.2, I can't add labels which have whitespace in them, such as "test1 test2" " withe space".
I use the add-label macro like this:
{add-label:test1 test2} {add-label:white space}Is this a bug? Is there anyway to add such kind of labels by using add-lable macro?How can I solve this problem?
Any help or suggestion will be appreciated.
Nov 20, 2009
Carry Megens says:
labels cannot have whitespace (and some other prohibited chars) in them. I found...labels cannot have whitespace (and some other prohibited chars) in them. I found somewhere a usermacro called safelabel or similar that filtered out invalid label chars and delivered a clean label, safe to add.
Aug 24, 2010
Chris Mears says:
The template that is used to create new pages in our Wiki has some variables tha...The template that is used to create new pages in our Wiki has some variables that I would like to have also saved as labels for that page. I have used add-label and been happy with the result for hard-coded labels but I can't get it to work with my new idea. I saw some other references in this thread discussing dynamic labels. Currently we are trying a variation based on replace-and-render but it quite bulky. What I would like to be able to do is:
where variable name is from the populated from elsewhere in the page.
Thanks.
/chris
Aug 24, 2010
Chris Mears says:
Sorry. I hit Save twice.Sorry. I hit Save twice.