This User Macro is very useful:

  • You can count pages in spaces
  • You can obtain the last modified date (and the modifier author if you want)
  • You can show a list of spaces with links to quick access
  • You can “clean” or “archive” old spaces

Installation instructions: (see picture)

Captura de pantalla 2019-05-03 a las 18.49.31.png


The Template of code (the source):


## Macro title: Page counter
## Macro has a body: Y or N (N)
## Body processing: Selected body processing option
## Output: Selected output option
## Developed by: Cedric DEVAUX
## Date created: 21/07/2014
## Modified by: Raul Pelaez MRADDON
## Date modified: 03/05/2019
## Macro to count pages in the space.
## @noparams
## Settings
## the spaceManager gives you access to the spaces
#set($spaceManager =$containerContext.getComponent(‘spaceManager’))
<h2>List of Spaces</h2>
<table class=”confluenceTable”>
<th class=”confluenceTh”>Space Name</th>
<th class=”confluenceTh”>Page Count</th>
<th class=”confluenceTh”>Last Modified</th>
#foreach($sp in $spaceManager.getAllSpaces())
<a href=”/display/$sp.getKey()”>$sp.getName()</a>



Macro based on this post

By MrAddon


Posted by:.

5 replies on “New Macro to show a list of spaces and pages and last modified date in Confluence

  1. Hello ,
    I tried with the above macro, But I am getting the following errors.
    Error rendering macro ‘pagecounter’

    Error occurred rendering template content

    Could you please help with this error.

    Thanks in advance


    1. Hello Rama,
      Just copy the code between PRE tags and paste in your Confluence Macro config section.
      Remember to replace the (“) characters by (“) correct ones… is a typical problem of WordPress pages (they process the content of the page and replace some parts)


Leave a Reply to Cedric Devaux Cancel reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s