Forums

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

incoming-links filter by labels

Rafal Niznik
Contributor
October 20, 2020

I have created following 

## @noparams
#foreach ($link in $action.getIncomingLinks())
<a href="$link.getSourceContent().getUrlPath()">$link.getSourceContent().getTitle()</a>
<br>
#end

This code is placed on some website and it shows all incoming-links.
The problem is that this code shows all incoming-links

My Question:

Is there a way to filter incoming-links by labels ? 
Maybe someone knows how to place incoming-links inside Content by Label’ Macro so labels can be applied ?


Thanks,

Rafal

 

 

1 answer

0 votes
Diego
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 22, 2020

Hello @Rafal Niznik !
Upon reading the AbstractLink Class document, I saw the getSourceContent method. It returns an object of the ContentEntityObject type. This type, in return, has the getLabels method inherited from com.atlassian.confluence.core.AbstractLabelableEntityObject.

You judging by this, you should be able to use the getLabels to work with the labels for that object.

However, seeing that Velocity has different contexts, I believe that this documentation may come in handy:

Here you can also check the extra objects that are available for user macros in Confluence Server:

I would also like to point out that our sister community, the Developer Community may be better equipped to deal with this kind of development for Confluence! You can take a look here:

Let us hear from you!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events