Generate a dynamic list of links for all space templates using Reporting and Linking

Generate a dynamic list of links for all space templates using Reporting and Linking

Scenario

Viewing all space templates in every space on a Confluence instance can be a tedious task. The following recipe generates a report listing the links to all space templates for quick and immediate access.

Result

 

Recipe

Apps

 

Linking for Confluence, Reporting for Confluence

 

Platform

Server

Level

Easy

Estimated time

10 minutes

Macros

Report Column, Report Info, Report Table, Space Reporter

Suppliers

Space Supplier

Storage format

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

<ac:structured-macro ac:macro-id="9aadf0c6-7fe4-4fea-a1b6-f15e727a4430" ac:name="report-table" ac:schema-version="1"> <ac:rich-text-body> <ac:structured-macro ac:macro-id="6dbd5edb-1e01-44c6-90fc-3ce2d79a48bc" ac:name="space-reporter" ac:schema-version="1"> <ac:parameter ac:name="space"> <ri:space ri:space-key="@all" /> </ac:parameter> <ac:rich-text-body> <p>&#xa0;</p> </ac:rich-text-body> </ac:structured-macro> <ac:structured-macro ac:macro-id="f3c08354-99b5-43cc-ab0c-9120270104cf" ac:name="report-column" ac:schema-version="1"> <ac:parameter ac:name="title">Space</ac:parameter> <ac:rich-text-body> <p> <ac:structured-macro ac:macro-id="5680bc0a-5f79-472e-8036-0d21f8ca0edb" ac:name="report-info" ac:schema-version="1"> <ac:parameter ac:name="">space:name</ac:parameter> </ac:structured-macro> </p> </ac:rich-text-body> </ac:structured-macro> <ac:structured-macro ac:macro-id="21c1ffad-0744-4bb0-9f18-2b0d9e36df65" ac:name="report-column" ac:schema-version="1"> <ac:parameter ac:name="injected">true</ac:parameter> <ac:parameter ac:name="title">Links to Space Templates</ac:parameter> <ac:rich-text-body> <p> <ac:structured-macro ac:macro-id="e821fb06-8edf-412d-974e-21121836088e" ac:name="link-to" ac:schema-version="1"> <ac:parameter ac:name="linkText">Link</ac:parameter> <ac:parameter ac:name="space"> <ri:space ri:space-key="%space:key%" /> </ac:parameter> <ac:parameter ac:name="">space templates</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 the Reporting Report Table macro to format the report as a table.

  2. Within the Report Table macro, add the Reporting Space Reporter with the Spaces parameter set to @all to retrieve all spaces in Confluence.

  3. Within the Report Table macro, add the Reporting Report Column macro with the Title parameter set to Space.

  4. Within the Report Table macro, add another Report Column macro with the Title parameter set to Links to Space Templates and the Injected parameter selected.

  5. Within the first Report Column, add the Reporting Report Info macro with the Key parameter set to space:nameto display the name of each space retrieved by the Space Reporter macro.

  6. Within the second Report Column, add the Linking Link to Location macro with the following parameters to add a link to each space template.

    • Set the Location parameter to space templates

    • Set the Link Text parameter to Link

    • Set the Space parameter to %space:key% to indicate the space of the link it's referring to.
      The enclosing '%' sign indicates an injected value, meaning it will retrieve the supplier value within to inject into the macro parameter before the macro is rendered.