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
thanks
Community moderators have prevented the ability to post new answers.
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 )
#end
#if ( $spaceToDisplay == "" )
<p> Space with key "$paramSpaceKey" not found. </p>
#else
<p> Pages in space $spaceToDisplay.key </p>
#set ( $topLevelPages = $pageManager.getTopLevelPages($spaceToDisplay) )
<div>
<ul>
#foreach ( $topLevelPage in $topLevelPages )
<li>
<a href="${req.contextPath}$topLevelPage.urlPath"> $topLevelPage.title </a> - $topLevelPage.id
</li>
#parseChildren($topLevelPage)
#end
</ul>
</div>
#end
#macro(parseChildren $pageToParse)
#set ( $pageChildren = $pageToParse.getChildren() )
#if ( $pageChildren != "[]" )
<ul>
#foreach($childPage in $pageChildren)
<li>
<a href="${req.contextPath}$childPage.urlPath"> $childPage.title </a> - $childPage.id
</li>
#parseChildren($childPage)
#end
</ul>
#end
#endIf 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 ![]()
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, '|http://yourwiki.com/pages/editpage.action?pageId=',C.contentid,']') AS ViewURL
FROM CONTENT C
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.titleNote 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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.