Description

  • The Choose Label macro provides the user with predefined options for adding labels and generated suggested 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 Choose Label macro from the provided list.

choose label macro list
  • Complete the desired fields.

Parameter Description Type Default Required

Title

Specify a title for the macro which will be displayed above the macro.

string

none

no

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

Descriptions

A comma separated list of descriptions that can be applied to labels. If left empty, the description of each label will be the same as the label

string

none

no

Button text

Specify custom text for the add label button.

string

"Add Label"

no

Multiselect

Allow multiple labels to be added at the same time

boolean

false

no

Label suggestions

Allow the system to suggest labels based on the content of the page

boolean

false

no

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.

Note

Label suggestions will only start working once at least 100 words are added to the page. Label suggestions become more accurate as more words are added, with good suggestions arising over 500 words. Supported languages are English, German, Dutch and Danish.

  • The macro will then appear on the page.

choose label macro pic
  • The next time the page where the macro is located is opened the choose label macro will be shown. Only the applicable labels will be shown. If all the labels are already present on the page, the macro is not shown.

Examples

Example one

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

choose label macro config example

The rendered macro will then appear on the page.

choose label macro render example
Note

The $year variable resolves to 2016 and if chosen 2016 will be added as a label on the bottom right of the page. Multiple selections can be made.

Example two

  • To use the generated label suggestions feature simply tick the "Label suggestions" checkbox. The macro will then make best effort label suggestions based on the page content.

choose label macro config example2

The rendered macro will then appear on the page.

choose label macro render example2

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.