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

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

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}

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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published yesterday in Hipchat

Moving from Hipchat to Stride? Here’s what you’ll love

Heya, Hipchat friends! We’re so happy you’re checking out   Stride. Whether you know it or not, you have been instrumental in making Stride come to life. Every feature, design, and functionality...

61 views 2 6
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you