Forums

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

Writing Macro to add Labels based on Article content

Jonathan Jacobi
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 25, 2017

So I wanted to create a macro (very similar to http://confluence-addons.connect.adaptavist.com/label-tools/latest/choose-label-macro.html but definitely not identical unfortunately :\ )

That adds labels/suggest in a popup box or something similar from a given list, in case the words in the label-list appear in the confluence article.

 

Is it possible?

Can I do it "macro-only"?

Without creating a plugin or anything like that..?

Thanks a lot!!!

1 answer

0 votes
Stephen Deutsch
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.
September 26, 2017

This might be a good starting point:

https://community.atlassian.com/t5/Jira-questions/How-do-I-add-labels-to-a-page-using-a-user-macro/qaq-p/129512

Although the code is old, it should still work. Just don't forget to change the &lt; and &gt; to < and > respectively.

Jonathan Jacobi
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 26, 2017

How do I use this function?

https://docs.atlassian.com/confluence/5.9.9/com/atlassian/confluence/labels/LabelManager.html#getSuggestedLabelsInSpace-com.atlassian.confluence.labels.Labelable-java.lang.String-int-

 

I don't know what parameters I should give it, but it seems like it would give me exactly what I need, and then I will only need to list it.

maybe, if it is possible, how do I access the page's content?

I could check the page's content and if some words exist there, I will add them as labels- that seems like an ideal solution, don't you think ?:)

 

Thanks a lot!!!!! :-)

rohit patel November 5, 2018

Hi Stephen,

I am also trying to achieve something similar. I am very new to confluence and still learning. I just wanted to know how do i use the code that is provided on https://community.atlassian.com/t5/Jira-questions/How-do-I-add-labels-to-a-page-using-a-user-macro/qaq-p/129512 

Regards,

Rohit

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events