List labels by excluding other labels

Scenario

This recipe is to list the labels from pages by excluding other labels.

There is a situation where there are uncategorized labels that keep changing while those that are categorized are not.

With the uncategorized labels are added more frequently, it is hard to find them all.

Hence, by excluding the labels categories that are not changing, we can quickly get the ones that keep changing.

Result

 

Recipe

Apps

Reporting for Confluence Server & Data Center

Apps

Reporting for Confluence Server & Data Center

Level

Intermediate

Estimated time

30 minutes

Macros

Content Reporter, Expanding Reporter, Grouping Reporter, Report Body, Report Info, Report List, Text Filter, Text Sort

Suppliers

Content Supplier, Expanded Supplier, Grouped Supplier, Label Supplier

Storage format

You can copy and paste this code into the Confluence Source Editor:

<ac:structured-macro ac:macro-id="b71b7676-570a-44d7-88cf-c760649d6b4b" ac:name="report-list" ac:schema-version="1"> <ac:rich-text-body> <ac:structured-macro ac:macro-id="341ad03b-59c8-4433-8b15-25d422e125a6" ac:name="grouping-reporter" ac:schema-version="1"> <ac:parameter ac:name="as">myUniqueLabel</ac:parameter> <ac:parameter ac:name="">expanded:myLabel</ac:parameter> <ac:rich-text-body> <ac:structured-macro ac:macro-id="c3e01907-e549-4e9c-a819-abd1063f79c0" ac:name="expanding-reporter" ac:schema-version="1"> <ac:parameter ac:name="as">myLabel</ac:parameter> <ac:parameter ac:name="">content:labels</ac:parameter> <ac:rich-text-body> <ac:structured-macro ac:macro-id="beb68d0a-58db-4843-bee1-316b4f49a29f" ac:name="content-reporter" ac:schema-version="1"> <ac:rich-text-body> <p> <br /> </p> </ac:rich-text-body> </ac:structured-macro> <p> <ac:structured-macro ac:macro-id="5c43a599-be4f-4668-b5c4-faeeb31e1459" ac:name="text-sort" ac:schema-version="1"> <ac:parameter ac:name="">label:title</ac:parameter> </ac:structured-macro> </p> </ac:rich-text-body> </ac:structured-macro> <p> <ac:structured-macro ac:macro-id="8daafd43-50ef-45ba-b1c5-c2db123e6fbb" ac:name="text-filter" ac:schema-version="1"> <ac:parameter ac:name="exclude">lab1|lab2|lab3</ac:parameter> <ac:parameter ac:name="">grouped:myUniqueLabel</ac:parameter> </ac:structured-macro> </p> <ac:structured-macro ac:macro-id="88f04b85-36c8-44c5-988b-14c243668321" ac:name="text-filter" ac:schema-version="1"> <ac:parameter ac:name="exclude">demo|forum|q&amp;a|training|panel|test</ac:parameter> <ac:parameter ac:name="">grouped:myUniqueLabel</ac:parameter> </ac:structured-macro> </ac:rich-text-body> </ac:structured-macro> <p> <br /> </p> <p> <br /> </p> <ac:structured-macro ac:macro-id="35b944f9-b0e9-424c-8a86-cfdb0c3e3462" ac:name="report-body" ac:schema-version="1"> <ac:rich-text-body> <p> <ac:structured-macro ac:macro-id="3695e283-f581-47e1-b42d-cb72adb69d43" ac:name="report-info" ac:schema-version="1"> <ac:parameter ac:name="link">true</ac:parameter> <ac:parameter ac:name="">grouped:myUniqueLabel</ac:parameter> </ac:structured-macro> </p> </ac:rich-text-body> </ac:structured-macro> </ac:rich-text-body> </ac:structured-macro>

 

Macro structure

You can recreate the example in the editor view:

 

Steps

  1. Add a Report List macro.

  2. Inside it, add a Grouping Reporter and a Report Body macro.

  3. For the Grouping Reporter macro, set the following settings:
    Key = expanded:myLabel
    As = myUniqueLabel

  4. Inside the Grouping Reporter macro, add the following macro with the settings:

    1. Expanding Reporter macro
      Key = content:labels
      As = myLabel

    2. Text Filter macro
      Key = grouped:myUniqueLabel
      Exclude = add the excluded labels here with 'pipe' as the separator, for example, lab1|lab2|lab3

    3.  If there is another label category that needs to be excluded, add another Text Filter macro.

  5. Then, inside the Expanding Reporter macro above, add the following macro with the settings:

    1. Content Reporter macro

    2. Text Filter macro
      Key = label:title

  6. Navigate to the Report Body macro that is created alongside the Grouping Reporter macro, add the following macro inside it:

    1. Report Info macro
      Key = grouped:myUniqueLabel
      Link to item = enabled

 

Line-by-Line Explanation

  • N/A

 

Â