Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Label list macro: ignore numeric labels

Max E August 30, 2018

Hi there!

I am looking for a solution to list all labels of a space as in the list-label macro. However, as there are hundreds of document numbers in our spaces, I would like to ignore all labels that start with a number. 

Maybe there is an easy way of writing a short user macro. Anyone?

Max

2 answers

0 votes
Bill Bailey
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.
August 30, 2018

Yes, you can! It will be some work, but you can walk through pages to get a list of labels. Take a look at this macro for some guidance:

https://github.com/unidwell/confluence-include-child-pages-macro

Maybe the getLabels() method works for retrieving all the labels in space?

https://docs.atlassian.com/atlassian-confluence/5.9.9/com/atlassian/confluence/labels/LabelManager.html

OR, you may be able to render the label-list macro within a user macro, and RegEx filter the list from there.

0 votes
Dave Bosman [Realdolmen]
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.
August 30, 2018

Hi @Max E

I am not really a developer so i can't solve this without some help of someone that knows javascript. 

If you or someone on your team has this knowledge you should be able to write a small javascript file that uses regex to do a check on all the labels and remove or hide them if necessary. 

This will work perfectly in a user macro. 

Regards

Dave

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events