List all pages in a space showing page IDs as well as titles?

Does anyone know if a way to list all pages within a confluence space, but with Page IDs as well as page titles? Either via a plugin or something more complex such as a sql report? I know how to get individual page IDs but this is not what I am looking for. I want to generate a list of all pages showing the page ID as well as page title. Running confluence server 5.8.x


2 answers

This widget could not be displayed.
Stephen Deutsch Community Champion Sep 21, 2015

Hi Helen,

Here's a user macro that not only outputs all pages, but also does it in a tree so that you can see the relationships between the pages:

## @param SpaceKey:title=Space Key|type=string
#set ( $spaceToDisplay = "" )
#set ( $spaceToDisplay = $spaceManager.getSpace($paramSpaceKey) )
#if ( !$paramSpaceKey )
  #set ( $spaceToDisplay = $space )
#if ( $spaceToDisplay == "" )
  <p> Space with key "$paramSpaceKey" not found. </p>
  <p> Pages in space $spaceToDisplay.key </p>
  #set ( $topLevelPages = $pageManager.getTopLevelPages($spaceToDisplay) )
       #foreach ( $topLevelPage in $topLevelPages )
         <a href="${req.contextPath}$topLevelPage.urlPath"> $topLevelPage.title </a> - $
#macro(parseChildren $pageToParse)
  #set ( $pageChildren = $pageToParse.getChildren() )
  #if ( $pageChildren != "[]" )
    #foreach($childPage in $pageChildren)
        <a href="${req.contextPath}$childPage.urlPath"> $childPage.title </a> - $

If you put it on a page and don't choose any space key, it will do the current space.  If you choose a space key, then it will search the space with that space key smile

This widget could not be displayed.

You can use the Bob Swift Confluence Command Line Interface (CLI) add-on with this command to create CSV output with that information:

--action getPageList --space "yourspacekey" --outputFormat=2

You can also use the Bob Swift SQL for Confluence add-on (which comes in both Express and Pro editions) using a query like this (written using MySQL):

SELECT C.title, C.contentid, CONCAT('[',C.title, '|',C.contentid,']') AS ViewURL
INNER JOIN SPACES S ON S.spaceid = C.spaceid
WHERE S.spacekey = 'general' AND C.content_status = 'current' AND C.contenttype = 'PAGE'
ORDER BY C.title

Note that the SQL add-on has the ability to automatically render its output in a table. If you want to render CLI output in a table, you will need the Bob Swift Advanced Tables for Confuence add-on.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Monday in Confluence

Why start from scratch? Introducing four new templates for Confluence Cloud

Hi my Community friends!  For those who don't know me, I'm a product marketer on the Confluence Cloud team - nice to meet you! For those of you who do, you know that I've been all up in your Co...

464 views 6 6
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you