Hi!
I'm using Confluence 3.4.9 and I need to know how I could count all pages within a given space that share a specific label (something like "contentbylabel" combined with a counter).
A user macro would be perfect.
Any help?
Thanks a lot in advance.
Community moderators have prevented the ability to post new answers.
## @param ParentPage:title=Page|type=confluence-content|required=true|desc=Select a page for which to count the children ## @param Label:title=label|type=string|required=true|desc=Specify a label to count #set($pageCount = 0) #set ( $colonIndex = $paramParentPage.indexOf(":") ) #if ( $colonIndex == -1 ) #set ( $parentSpaceKey = $space.key ) #set ( $parentPageName = $paramParentPage ) #else #set ( $parentSpaceKey = $paramParentPage.substring(0, $colonIndex) ) #set ( $parentPageNameIndex = $colonIndex + 1 ) #set ( $parentPageName = $paramParentPage.substring($parentPageNameIndex) ) #end #set ( $parentPage = $pageManager.getPage($parentSpaceKey, $parentPageName) ) #foreach( $child in $parentPage.descendents ) #foreach( $childlabel in $child.labels ) #if($childlabel.name == $paramLabel ) #set($pageCount = $pageCount +1) #end #end #end <p>Under $parentPageName there are $pageCount pages with the label $paramLabel</p>
Hi Rodrigo,
unfortunately it does not. I am not allowed to install the reporting plugin an the macro shown only counts the children of the CURRENT page.
Can you modify the macro to count children of a specific page (that have a specific label)?
Thanks in advance.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nicolai,
I could find this answer which contains some examples of usermacros to count pages given a specific parent page.
I hope this helps!
Cheers,
Rodrigo
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.