I want to display all pages and counts in confluence page.
Can we create a macro for that?
Also I want to display the maximum count of pages.
All should be display in table format.
Hi you can try this user macro:
## 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 ## Macro to count pages in the space. ## @noparams ## Settings #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 spaceManager gives you access to the spaces #set($spaceManager =$containerContext.getComponent('spaceManager')) <h2>Page counter per spaces</h2> <table class="confluenceTable"> <tr> <th class="confluenceTh">Space Name</th> <th class="confluenceTh">Count</th> </tr> #foreach($sp in $spaceManager.getAllSpaces()) #if($sp.isGlobal()) <tr> <td> <a href="/display/$sp.getKey()">$sp.getName()</a> </td> <td> $spaceManager.findPageTotal($sp) </td> </tr> #end #end </table>
"Display all pages" does not make sense. You want to include the content of every page in one place? For even a small Confluence, that's not going to work - you'll have thousands of pages and it'll take too long to build and render.
Or do you mean a list of all pages, just their name? That's still not much use - a tiny new confluence will quickly have hundreds, and a typical one has tens of thousands.
I'm afraid "counts" makes no sense either. What are you counting?
Maximum count of pages? Ok, you want to count pages, what is the criteria? And what do you mean by "maximum" (As there's no specific limit in Confluence, maximum doesn't make any sense)
I think you need to explain your requirement better. What question are you trying to answer with these numbers and lists? Forget about tables, pages, counts for now, just tell us what your user (or you) want to know specifically and why?
Thanks for replay, I want to display on any confluence page in following table structure manner. Display all pages in one place with their counts. | All Pages | Count | | | | The table should be display the maximum count of page. Maximum count is when the page get loaded.
I'm afraid that does not make it any more clear. The closest I can imagine is not even a table, you just want to know how many pages you have. Your "all pages" column has no data because "all pages" is meaningless. Count is fine - it's the number of pages you have in your installation. It's available on the system-information page, so I imagine it would be quite easy to write a macro to extract it and hence say "this confluence has a total of X pages" There's still no "maximum" there, and "maximum count is when the page gets loaded" is still complete nonsense.
More and more people are building their careers with Atlassian, and we want you to be at the front of this wave! Important Dates Start the Certification Prep Course by 2 April 2019 Take your e...
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