Listing links to all space templates
Scenario
It can be a tedious task to view all space templates in every space on a Confluence instance. 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 Server & Data Center  |
---|---|
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> </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
The report will be formatted as a table with Report Table.
Space Reporter is used to retrieve all spaces in Confluence, with 'spaces' parameter is set to '@all'.
Two columns is created using Report Column, with title set accordingly. Second column's 'injected' parameter is set to true to allow injection of supplier at #5.
Name of each spaces retrieved from Space Reporter is displayed via Report Info, setting supplier key to 'space:name'.
The link to each space's space templates page is created with Link to Location. Location parameter is set to 'space templates'. Link Text parameter is set to 'Link'. To indicate the space of the link it's referring to, the 'space' parameter is set to '%space:key%'. The enclosing '%' sign indicates injected value, meaning that it will retrieve the supplier value within to inject into the macro parameter before the macro is rendered.
Â
Line-by-Line Explanation
N/A