Hi!
I am in need of a simple solution to audit and keep relevant information in a Confluence Space. My thought is to have at least one Space admin that are responsible for keeping the information up to date. For this I have created a page that only the space admins can see, and on that page is a user macro that I have found searching far and wide on the web. This user macro presents all pages in a space that haven´t been updated for X days, and by doing this it is easy to go in and have a look at all the pages that needs an update. They are then able to just do an update on the page to keep the the information up to date.
However I have noticed that I would very much would like to exclude some pages in this report. For example all the meeting notes (that could be handy to still keep but doesn´t need an update) would be very good to exclude from the user macro. So I was thinking that maybe we could update this user macro to exclude pages with a specific label, the problem is that I am not a developer so my knowledge around this is very limited.
Therefore I would very much appreciate if someone would be able to help me with this task. I think this would benefit a lot of other Confluence admins as well that have similar requests from management etc.
This is the user macro I have and would like to be able to exclude pages with certain labels:
## Macro title: Old Pages
## Macro has a body: Y or N (N)
## Body processing: Selected body processing option
## Output: Selected output option
##
## Developed by: Andrew Frayling
## Date created: 05/02/2012
## Installed by: <your name>
## Macro to display pages that have not been updated for x days
## @Param numdays:title=Number of Days|type=int|desc=Enter number of days to compare|required=true|multiple=false|default=180
#set ( $allPagesInSpace = $pageManager.getPages($space, true) )
## default value handler, set default to 180 days
#set ( $numdays = $paramnumdays )
#if(!$numdays)
#set ( $numdays = "180" )
#else
#set ( $numdays = $paramnumdays )
#end
## cast the number of days to an Integer
#set ( $Integer = 0 )
#set ( $intnumdays = $Integer.parseInt($numdays) )
## negative sign the number of days
#set ( $negativeDays = (-1 * $intnumdays) )
## get a calendar object so we can calculate the
## date we wish to compare with the page modification date
## e.g. $compareDate.add(6, -7) for pages modified over a week ago
#set ( $compareDate = $action.dateFormatter.getCalendar() )
$compareDate.setTime($content.getCurrentDate())
$compareDate.add(6, $negativeDays)
<p>Pages last updated before <strong>$action.dateFormatter.format($compareDate.getTime())</strong></p>
<table>
<tr>
<th>Page</th><th>Created</th><th>Created By</th><th>Last Updated</th><th>Last Updated By</th>
</tr>
## loop through all the pages in the current space
#foreach($page in $allPagesInSpace)
## get a calendar object and for each page in space set it to last modification date
#set ($pagedate = $action.dateFormatter.getCalendar())
$pagedate.setTime($page.getLastModificationDate())
## only display pages last modified before the compare date
#if ($pagedate.before($compareDate))
<tr>
<td>#contentLink2($page true false)</td>
<td>$action.dateFormatter.format($page.getCreationDate())</td>
<td>#usernameLink($page.creatorName)</td>
<td>$action.dateFormatter.format($page.getLastModificationDate())</td>
<td>#usernameLink($page.lastModifierName)</td>
</tr>
#end
#end
## end looping through pages in the current space
</table>