Hi,
I want to show a page label within the content the same way as it appears at the bottom of the page. I got to the stage where the labels are displayed following this suggestion by Steve (https://community.atlassian.com/t5/Answers-Developer-Questions/Is-there-a-way-to-place-a-list-of-the-page-s-labels-in-a/qaq-p/570841), but the rendered labels are simple text, not hyperlinks. My code is the following:
## Macro title: Page labels## Macro has a body: N## Body processing: No macro body#### Developed by: Steve Behnke## @noparams#set($currentPage = $pageManager.getPage($content.getId()))#set($pageLabels = $currentPage.getLabels())<span> #foreach( $labelObject in $pageLabels ) <span class="aui-label">$labelObject.name</span> #end</span>
I guess the link element should go into the #foreach section, but I don't know how. Any help is much appreciated.
Many thanks,
Peter
Hi @Peter Baschan,
this should work:
#foreach( $labelObject in $pageLabels )<span class="aui-label"> <a class="aui-label-split-main" href="/label/$space.key/$labelObject.name" rel="tag">$labelObject.name</a></span> #end
Yes that should work. I built a similar structure for a macro recently.
Works like a dream. Many thanks!
You’re welcome, @Peter Baschan
It looks like you're new here. Sign in or register to get started.