List pages with username labels

List pages with username labels

Scenario

This recipe generates a list of the pages that hold a label that matches the logged-in user.

Result

Recipe

Apps

Reporting for Confluence Data Center

Level

Easy

Estimated time

10 minutes

Macros

Content Reporter, Report Column, Report Info, Report Table

Suppliers

Global Supplier, User Supplier

Storage format

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

<h4 class="auto-cursor-target">Generating a report of pages that have labels</h4> <p> <br/> </p> <ac:structured-macro ac:macro-id="687a3c4b-d8eb-4b8f-8831-0325192030b2" ac:name="report-table" ac:schema-version="1"> <ac:parameter ac:name="maxResults">50</ac:parameter> <ac:parameter ac:name="injected">true</ac:parameter> <ac:rich-text-body> <p class="auto-cursor-target"> <br/> </p> <ac:structured-macro ac:macro-id="e1ef115a-c940-46d4-b895-7b8d13a0ffed" ac:name="content-reporter" ac:schema-version="1"> <ac:parameter ac:name="labels">%global:current user&gt;user:name%</ac:parameter> <ac:rich-text-body> <p> <br/> </p> </ac:rich-text-body> </ac:structured-macro> <p class="auto-cursor-target"> <br/> </p> <ac:structured-macro ac:macro-id="ab873efa-53b8-4070-9cbb-1462198fa8fe" ac:name="report-column" ac:schema-version="1"> <ac:parameter ac:name="title">title</ac:parameter> <ac:rich-text-body> <p> <ac:structured-macro ac:macro-id="c27b443f-4660-45f9-a686-363034f499b3" ac:name="report-info" ac:schema-version="1"> <ac:parameter ac:name="link">true</ac:parameter> <ac:parameter ac:name="">page:title</ac:parameter> </ac:structured-macro> </p> </ac:rich-text-body> </ac:structured-macro> <p class="auto-cursor-target"> <br/> </p> <ac:structured-macro ac:macro-id="ec34038f-1b6a-442f-b43e-deb50c3c84f5" ac:name="report-column" ac:schema-version="1"> <ac:parameter ac:name="title">Label</ac:parameter> <ac:rich-text-body> <p> <ac:structured-macro ac:macro-id="3b0b007c-0405-4e16-9c81-3664e9ac5d7b" ac:name="report-info" ac:schema-version="1"> <ac:parameter ac:name="link">true</ac:parameter> <ac:parameter ac:name="">page:labels&gt; join with ","</ac:parameter> </ac:structured-macro> </p> </ac:rich-text-body> </ac:structured-macro> <p class="auto-cursor-target"> <br/> </p> </ac:rich-text-body> </ac:structured-macro> <p class="auto-cursor-target"> <br/> </p>

 

Macro structure

You can recreate the example in the editor view:

Steps

  1. Create a Report Table macro with the following parameters:

    • Injected: selected

    • Max Results50

  2. Within the Report Table macro, create a Content Reporter macro with Labels: %global:current user>user:name%.

  3. Under the Content Reporter macro, create a Report Column macro with Title: Page Title.

  4. Within the Page Title Report Column macro, create a Report Info macro with Key: page:title.

  5. Under the Page Title Report Column macro, create another Report Column macro with Title: Label/Username.

  6. Within the Label/Username Report Column macro, create a Report Info macro with Key: page:labels> join with ",".