How to Get a Listing or Count of Child Pages Under a Parent Page
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
For purposes of auditing or organization, Confluence administrators may find it useful to see which pages are nested under a given parent page, and how many. This is helpful when examining a large space, to see which branch in the page tree contains the most pages.
Solution
Via the UI, by editing the page and grabbing the "pageId" value from the address bar
Via the database, by running:
1
SELECT contentid FROM CONTENT WHERE prevver IS NULL AND title = 'Your Page Title';
Run a query below, depending on what you want to do:
Getting a listing of all pages (pageId and title) under the parent
1
SELECT c.contentid, c.title FROM CONFANCESTORS a JOIN CONTENT c ON a.descendentid = c.contentid WHERE a.ancestorid = <parent_page_id>;
Getting a total count of pages under the parent
1
SELECT COUNT(*) FROM CONFANCESTORS WHERE ancestorid = <parent_page_id>;
Related pages
Was this helpful?