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.
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>
Thank you, I will give that a try...
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
It looks like you're new here. Sign in or register to get started.