Include a list of the editable child pages and a link for creating new pages using Reporting, Visibility, and Linking

Include a list of the editable child pages and a link for creating new pages using Reporting, Visibility, and Linking

Scenario

This recipe is handy if you want to have a parent page present an aggregated view of all its children, displayed in full. This recipe includes an Edit link for each section, which will automatically allow the user to edit the listed page. It combines the functionality offered by Reporting for ConfluenceLinking for Confluence and Visibility for Confluence add-ons.

The steps will guide you on how to include the content of all children of a page, headed by the page title and a link to edit the page.

 

Result

 

Recipe

Apps

 

Linking for Confluence, Reporting for Confluence, Visibility for Confluence

 

Apps

 

Linking for Confluence, Reporting for Confluence, Visibility for Confluence

 

Platform

Server

Level

Advanced

Estimated time

30 minutes ⏱

Macros

N/A

Suppliers

Content Supplier

Storage format

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

<p class="auto-cursor-target"> <br /> </p> <ac:structured-macro ac:macro-id="9250fecf-e394-4533-aefa-737973f26698" ac:name="report-block" ac:schema-version="1"> <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter> <ac:rich-text-body> <p class="auto-cursor-target"> <br /> </p> <ac:structured-macro ac:macro-id="a8b07332-112a-468b-aa12-144feaac98f8" ac:name="content-reporter" ac:schema-version="1"> <ac:parameter ac:name="scope">@self &gt; children</ac:parameter> <ac:rich-text-body> <ac:structured-macro ac:macro-id="b645edb4-b2ea-4cde-a68b-11b8ad9df2f7" ac:name="text-sort" ac:schema-version="1"> <ac:parameter ac:name="">content:title</ac:parameter> </ac:structured-macro> </ac:rich-text-body> </ac:structured-macro> <p class="auto-cursor-target"> <br /> </p> <ac:structured-macro ac:macro-id="a7f431c4-4ce8-44c4-b231-01eb6e988daa" ac:name="report-body" ac:schema-version="1"> <ac:rich-text-body> <h2> <ac:structured-macro ac:macro-id="0a1652b8-bff2-4543-a75e-65f24043a7fb" ac:name="report-info" ac:schema-version="1"> <ac:parameter ac:name="link">true</ac:parameter> <ac:parameter ac:name="">content:title</ac:parameter> </ac:structured-macro> </h2> <ac:structured-macro ac:macro-id="7f427c06-26e1-476c-94ff-f48c14e1c190" ac:name="show-if" ac:schema-version="1"> <ac:parameter ac:name="spacePermission">edit</ac:parameter> <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter> <ac:rich-text-body> <p> <em>(<ac:structured-macro ac:macro-id="3adaafeb-d74e-4f39-b4ac-d9e2a8908e24" ac:name="link-to" ac:schema-version="1"> <ac:parameter ac:name="linkText">Edit</ac:parameter> <ac:parameter ac:name="">page edit</ac:parameter> </ac:structured-macro>)</em> </p> </ac:rich-text-body> </ac:structured-macro> <p> <ac:structured-macro ac:macro-id="649d8ebc-de47-4937-96ae-8a1dd9adc97a" ac:name="report-info" ac:schema-version="1"> <ac:parameter ac:name="render">richtext</ac:parameter> <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter> <ac:parameter ac:name="">content:body</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> <ac:structured-macro ac:macro-id="0a6c97bc-a3ba-4fa7-bb6f-5ad1fd3438ff" ac:name="show-if" ac:schema-version="1"> <ac:parameter ac:name="spacePermission">@self:edit</ac:parameter> <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter> <ac:rich-text-body> <p> <ac:structured-macro ac:macro-id="9c7e5a7f-1977-4dca-be02-626118bc427e" ac:name="add-page" ac:schema-version="1"> <ac:parameter ac:name="parent">@self</ac:parameter> <ac:parameter ac:name="linkText">(+) Add a new section</ac:parameter> </ac:structured-macro> </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. Add the Reporting Report Block macro to format the report as a series of blocks.

  2. Within the Report Block macro, add the Reporting Content Reporter macro with the Scope parameter set to @self > childrento retrieve the child pages of the current page.

  3. Within the Content Reporter macro, add the Reporting Text Sort macro with the Key parameter set to content:title.

  4. Within the Report Block macro, add the Reporting Report Body macro with the Injected option selected so that we can inject values within the field of Link to Location macro (see step 7).

  5. Within the Report Body macro, add the Reporting Report Info macro with the Key parameter set to content:title to display the title of each page retrieved from Content Reporter macro.

  6. Within the Report Body macro, add the Visibility Show If macro with the Space Permissions parameter to @self:edit or edit to only display the contained contents (see step 7) if this current space can be edited by the current user.

  7. Within the Show If macro, add the Linking Link to Location macro with the following parameters to create a link to the edit view of each child page retrieved by the Content Reporter macro.

    • Set the Location parameter to page edit.

    • Set the Content parameter to %content:title%.
      The "%" sign indicates that the enclosed text are injected - the text within will be replaced by the value of supplier key "content:title".

    • Set the Link Text to Edit.

  8. Within the Report Body macro, add another Report Info macro with the Key parameter set to content:body and the Render parameter set to richtext.

  9. Within the Report Block macro, add another Visibility Show If macro with the Space Permissions parameter to @self:edit or edit to only display the contained contents (see step 10) if this current space can be edited by the current user.

  10. Within the Show if, add the Linking Add Page macro with the Parent parameter to @self and the Link Text parameter set to Add a new section