Hi out there,
is there an easy way to find all pages without a label? I know there is a macro for content by label and it is possible to exclude labels but right now we have nearly 160 labels and I do not want to add them all to the macro.
This is possible by writing a usermacro that iterates over all spaces and its pages searching for pages without a label. But such a usermacro will slow down your system dependent on how big your confluence instance is. Such a macro should only be shortly used by an administrator.
Here is the usermacro code.
## @noparams ## DO NOT USE THIS MACRO ON A LOT OF PAGES BECAUSE OF PERFORMANCE ISSUES. IT DEFINITELY WILL SLOW DOWN YOU SYSTEM!!!!! #set($containerManagerClass=$action.class.forName('com.atlassian.spring.container.ContainerManager')) #set($getInstanceMethod=$containerManagerClass.getDeclaredMethod('getInstance',null)) #set($containerManager=$getInstanceMethod.invoke(null,null)) #set($containerContext=$containerManager.containerContext) ## the pageManager gives you access to the pages #set($pageManager =$containerContext.getComponent('pageManager')) ## the spaceManager gives you access to the spaces #set($spaceManager =$containerContext.getComponent('spaceManager')) ##over all spaces (WARNING THIS COULD TAKE SOME TIME ON BIG CF INSTANCES ) #foreach( $space in $spaceManager.getAllSpaces() ) <b>Unlabeled pages in space $space.name<b> <ul> ##over each page in the current space ( WARNING THIS COULD TAKE SOME TIME ON BIG CF INSTANCES) #foreach( $page in $pageManager.getPages( $space, true) ) #if( $page.labels.size() == 0 ) <li><a href="$req.contextPath$page.urlPath">$page.title</a></li> #end #end </ul> #end
Testet with my Confluence 4.0.
This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.Read more
Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs