Display count of child and descendant pages

On this page:

Scenario

Create a report showing the number of direct child pages and all descendant pages of a specified parent page.

Result

reporting-children-descendant-pages.png

Recipe

Apps

Reporting for Confluence Cloud

Apps

Reporting for Confluence Cloud

Macros

Reporting

Estimated time

5 minutes

Steps

To build the report shown in the Result section above, follow these steps:

  1. Create a new Confluence page, add a Reporting macro, and give the page a suitable title.

  2. In the Query section on the left, set up the parent page query by typing the Confluence Query Language (CQL) syntax. For this example, use: type=page AND title="Get Started"
    Click Search to confirm the query matches your parent page.

  3. In the Add Expansions section, check the following boxes to retrieve child and descendant pages:

    • children > page

    • descendants > page

      reporting-cql-expansions.png
  4. Now, start building the columns of your report. To display the Parent page title in the first column, go to the Add report blocks section to add the first block, which will also be your first column.

    1. Go to Add Report Blocks, select Basic, then Add block.

    2. For Block title, type Parent page, and set the Value to content.title.

      Look at the screenshot to see how the block’s settings and preview should appear:

  5. Add another block for the Direct Children Count column, title it Direct Children Count, and set the Value to content.children.page.size

  6. Finally, add the block for the third column, title it All Descendants Count, and set the Value to content.descendants.page.size

Descendants include both direct and indirect children. So, if the Get Started page has 5 pages under it (at any depth), the descendants count will display 5.

  1. Check the Preview and Save your report.
    The final block configuration should appear as shown in the screenshot below:

  2. Publish the page, and you're done.

Â