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

0 votes
Accepted answer

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
Community showcase
Posted Tuesday in United States

Topic Tuesday: What's your favorite topic?

Good morning All, Our goal is to get you into the habit of while enjoying your favorite morning drink you are checking the NOVA "space" for topics and comments. Your input is really needed and...

62 views 4 0
View post

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