It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How many pages in a space?

Emily Johnson Jul 11, 2011

I just want to know how many pages are in a Confluence space without having to manually count or run a SQL query. I know the usage tracker plugin used to do it, and it was disabled by default because it impacted performance, but I cant find it even to run for a bit and then re-disable. Any other ideas>? I dont need anything fancy, just a page count.



8 answers

1 accepted

3 votes
Answer accepted
Matthew Cobby Jul 11, 2011

If you have the Reporting plugin, you could use this markup:

{report-info:space > all pages > size}

OR you could create a user macro.....

Name: pagecount

No Macro Body

Output generates wiki markup (or HTML doesn't really matter)


## get page manager...







Page Count: *$pageCount*

jim kennedy Jul 17, 2011

The fix described by Matthew above works for me, but only in the current space. If I do {pagecount} I get the number of pages in the current space.

Is there any syntax that would allow me to count the pages in a different space?

Jeremy Largman Atlassian Team Jul 17, 2011

Hi Jim,

I added another line to the user macro Count Pages in a Space. Check the green tip box.

jim kennedy Jul 18, 2011

Hi Jeremy, thanks but that doesn't seem to work for me. I should probabaly have mentioned that I'm on version 3.1.

Matthew Cobby Jul 18, 2011

Hi Jim, Jeremy's version is a much cleaner solution but it only works for 3.5+. I'm still working with 3.2 in our production instance and the updated example below should (hopefully) work for you (although I haven't got 3.1 to test it on)

jim kennedy Jul 18, 2011

Thanks Matthew, there are plans to upgrade from 3.1 straight to 3.5. I'm hoping a lot of our problems go away then.

Emily Johnson Jul 18, 2011

I used the pagecount macro, which you kind of create yourself. (I'm on version 3.5) Worked a treat. Thanks, Matthew!

5 votes
Tim Wong Jul 13, 2011

SQL-- Show number of CURRENT PAGES (as opposed to historical versions of pages) in every space:

    spaces s
    content c
    s.spaceid = c.spaceid
AND prevver IS NULL
1 vote
Matthew Cobby Jul 17, 2011

Modification of original user macro which takes the Space Code as the body of the macro

e.g. {pagecount}CONFTEST{pagecount}

## get page manager...










Space Name: *$spaceName*

Page Count: *$pageCount*

Milo Grika Jul 03, 2015

Can this be modified to get a count of child pages of a certain parent page?

1 vote
Kenta Yamamoto Atlassian Team Nov 30, 2016

For Confluence Cloud users, consider using REST API because Confluence Cloud doen't support SQL, Macro, or some Add-ons for stats.


# Total number of pages
curl -sGLu ${A_USER}:${A_PASSWD} "https://${INSTANCE_HOST}/wiki/rest/api/search" --data-urlencode 'cql=type IN (blogpost, page)' --data-urlencode 'limit=0' | jq '.totalSize'


Refer my related answer at For Confluence Cloud, how do I find the total number of pages? for more detail if you needed.


1 vote
David Gregory Dec 29, 2016

One brute force method that I have used is to:

  1. create a page in another space
  2. On that page place the Children Display macro
  3. Edit the macro and Show Descendents as well as fill in the Parent Page with the root of the page tree you wish to count (Space Home)
  4. Export this page to Word
  5. Use the Word native Statistics to get a count of the number of lines
  6. The number of pages will be 1 less than the number of lines since there is a line for the page name
0 votes
Betsy Walker Jul 11, 2011

Here's a user macro that does it, accepting a single parameter representing the SpaceKey of the space on which to report:

## pagecount - no body, unprocessed, generates WM
#if ($paramspace)
#set ($space=${paramspace})
#set ($space="WikiHelp")

{report-column:title=Pages}{report-info:space:all pages > collection:size}{report-column}

0 votes
Jeremy Largman Atlassian Team Jul 11, 2011

I figured I could write a quick user macro for this, so I went to go look at the available community User Macros, and there's one already. See Count Pages in a Space.

And, yes, I was indeed to my surprise to see that I was the author! Can't remember that at all... So, let me know if that doesn't work on your version and needs an update.

Matthew Cobby Jul 11, 2011

Hi Jeremy, I don't think that one works any more, not since they lost the .getPages() from the space object (3.1 cleanup?)

my attempt gets hold of the pageManager object to call it's getPages() method.

Jeremy Largman Atlassian Team Jul 11, 2011

You're right, sorry about that! I figured out what needs to happen in 3.5 and posted again. You need to use spaceManager:

Jonathan Simonoff Oct 15, 2012

findPageTotal returns a basically useless number that includes all versions of the pages. The JavaDoc notes "this probably doesn't give the number you are looking for."

Steve Mosley Jul 21, 2014

Is there any replacement for this in Confluence 5.5? as findPageTotel still appears to reutrn that number which isn't fit for this purpose.

0 votes
Jeremy Largman Atlassian Team Jan 29, 2012

I reopened this question. Questions need not be closed just because they're answered :).

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Confluence

Confluence CVEs and common questions

Two vulnerabilities have been published for Confluence Server and Data Center recently: March 20, 2019 CVE-2019-3395 / CVE-2019-3396 April 17, 2019 CVE-2019-3398 The goal of this article is...

950 views 0 19
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you