Content by Label - Replace Text in Link Text

Deleted user May 20, 2020

I am using the Content by Label macro and need to remove some text from the link that displays. For instance, there is page named "BMX - How to Replace Cranks" that has a label of "how_to" that is referenced in the macro. When the link renders, I would like for it to read "How to Replace Cranks" rather than "BMX - How to Replace Cranks".

 

How do I remove "BMX - " from the link text without having to modify the original page title?

 

Thanks!

1 answer

0 votes
Matt
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.
July 20, 2020

If this is for Confluence Server one possible (hacky) way of doing this would be to use JavaScript in the custom Header section.  

If you use jQuery you can do a quick search and replace on the Content By Label items. Something like this:

$('.content-by-label li').each(function(k,v) {
var l = $(v).find($('div.details a'))
var t = l.text().replace('BMX - ', '');
l.text(t);
});

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events