Forums

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

Aggregate label of current page and use it in a macro.

Stefan Eike
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.
June 25, 2012

Hi, I'm creating a template for landing pages of tools being used in the company. I want to create a single page for each tool. In my template I want to have a section, where I'm aggregating content by label. Because I want to automate as much as possible, I would appreciate having a predefined macro, which aggregares the (single) label of the page plus another label.

Example

I have a section in my tool-page called How-Tos and I want to generate a list of all pages labeled with the label howto plus the label of my current page (name of the tool). In this case, the user would not have to change anything in the section How-Tos.

{contentbylabel:label=howto,+PAGELABEL}

If the label of the current page is msword:

{contentbylabel:label=howto,msword}

Is there any way to do it? We're using Confluence 3.4.

2 answers

1 accepted

0 votes
Answer accepted
Stefan Eike
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.
June 25, 2012

Thanks matt,

I have found a solution and wrote this small user macro

## @noparams
{contentbylabel:labels=howto,$content.getTitle()|excerpt=true|operator=AND|sort=title}

0 votes
Matthew J. Horn
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.
June 25, 2012

to get the current page's labels, use the $content objects getGlobalLabels() method:

#set($labelList=$content.getGlobalLabels($action.getRemoteUser()))

hth,

matt

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events