Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,246,035
Community Members
 
Community Events
164
Community Groups

page properties report show labels

Is there a way to make a column that shows the labels attached to the page in each row of the table?  Just a checkbox in the Options section, like "Show comments count" or "Show likes count" would be sufficient.

3 answers

1 accepted

0 votes
Answer accepted

Here is how I would do it. You would add a property to all your pages inside the page properties macro called Labels. In that property you could add a macro that shows your page labels. Below is a user macro that does this.

Macro Name:
page_labels

Macro Title:
Page Labels

Description:
This will create clickable links for the labels on the current page that will show you other pages with that label.

Macro Body Processing:
No macro body

Template:

## Developed by: Davin Studer
## Date created: 08/04/20147
## @noparams

<span class="label-list">
#foreach ( $label in $content.getLabels() )
    <span class="aui-label">
        <a class="aui-label-split-main" href="/label/$content.spaceKey/$label">$label</a>
    </span>
#end
</span>

You can also do it like @Diego suggested here: Is there a way to display the label field onto a page properties report in confluence?

Then, the page properties report will show the labels that have been added to a page. Nevertheless, you need to add a page property Labels that holds the macro.

This is the macro I've written to do that. The labels are displayed the way they are displayed at the bottom of a page, and you can enter a label you do not want to display. This is useful for knowledge bases where you do not want to see the label "kb-how-to-article".

## Macro title: List Page Labels
## Macro has a body: No
## Body processing: No macro body
##
## Developed by: Kirstin Seidel-Gebert
## Date created: 11.05.2020
## Installed by: Kirstin Seidel-Gebert

## @param Labels:title=Label to omit|type=string|desc=Enter a label that should not be displayed.|required=false

## Get labels.
#set( $pageLabels = [] )
#set( $pageLabels = $content.getLabels() )

## Initialize list of labels to omit.
#set ( $omitLabelsString = "" )
#if ( $paramLabels )
#set ( $omitLabelsString = $paramLabels )
#end

## Build list of labels.
## --------------------------
#if ( $pageLabels )

<ul class="label-list" style="margin-top: 0; margin-left: 0; padding-left: 0;">

#foreach ($label in $pageLabels)
#set ( $lstr = $label.toString() )
#set ( $len = $lstr.length() )

#if ( $lstr != $omitLabelsString && $lstr.substring(0,1) != "~" )

#if ( ($len >= 3 && $lstr.substring(0,3) != "my:") || $len < 3 )

<li class="aui-label" style="margin-bottom: 0;" <a class="aui-label-split-main" href="/label/$space.key/$label" rel="tag">$label</a></li>

#end
#end
#end

</ul>

#end

Thank you, I will give that a try...

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Confluence Cloud

Presenter Mode for Confluence is here 🖥 👩‍💻

👋  Hello Community!  My name is Stephanie Zhang, and I’m a product manager on the Confluence cloud team. Today, I’m excited to announce the rollout of  Presenter Mode : a ...

1,035 views 9 25
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you