Description

  • The Add Label macro adds the specified labels to a page if they are not already present. We now allow the use of some predefined variables. Additionally through ScriptRunner for Confluence we also allow the user to overwrite these variables, or add user specified custom variables.

Usage

  • Click Insert > Other Macros.

macro browser
  • Select the Add Label macro from the provided list.

add label macro list
  • Complete the desired fields.

Parameter Description Type Default Required

Labels

Specify the labels using a comma separated list. Supplied variable labels are $username, $fullname, $year, $month, $day $parent (parent title of the current page)

string

none

yes

Note

Labels must obey naming restrictions imposed by Atlassian. The following characters are not allowed (:, ;, ,, ., , ?, &, [, ], (, ), #, ^, *, @, !, ' ' spaces ), and will be modified where possible to allow successful application of labels.

  • The macro will then appear on the page.

add label macro pic
  • The next time the page where the macro is located is refreshed the labels will be applied. If some of the labels are already present only the missing labels will be applied. If all the labels are already present, no action will be taken.

Example

  • To use the provided variables as labels simply add any supported variable as you would any normal label using the Add Label macro.

add label macro config example

Once this macro is saved and the page loaded the $year and $parent variable labels resolve to the current year, and the name of the parent page respectively. The added labels can be observed on the bottom right of the page.

add label macro final result

For how-to questions please ask on Atlassian Answers where there is a very active community. Adaptavist staff are also likely to respond there.

Ask a question about ScriptRunner for JIRA, for for Bitbucket Server, or for Confluence.