How to aggregate the contents of certain section of a page on one page?
Asked by Denis Boisvert:

I am trying to find a way to show the contents of all the pages with a certain section on one confluence page.

Is there a way to do this?

As an example, let's say we enter all our retrocession in confluence, we would like to show all item that we do best in the company in one page as a summary for manager.


Answers:
author: Davin Studer
body: Would the include-excerpt or include page macros fulfill what you are trying to do?

comments: author: Denis Boisvert
body: Hi Davin,

I tried the Excerpt Include Macro. It's a bit what I want but for multiple page. I could do it, but I would have to do it manually for each page.

I would like something more automatic, like show all contents of a space with an excerpt macro.

Maybe there is a plugin that do what I want.


author: Davin Studer
body: Do you want all the contents of each page, or just part? Would it work for you to apply a label to the pages that you want included on another page? Below is a User Macro to include the contents on pages with a specified label on another page.

**Macro Name:**   
include_by_label

**Macro Title:**   
Include By Label

**Template:**   
##Created by: Davin Studer  
##Date: 1/31/2014  

## @paramLabel:title=Label\|type=string\|required=true\|desc=Enter a label.  

#set( $containerManagerClass=$content.class.forName('com.atlassian.spring.container.ContainerManager') )  
#set( $getInstanceMethod=$containerManagerClass.getDeclaredMethod('getInstance',null) )  
#set( $containerManager=$getInstanceMethod.invoke(null,null) )  
#set( $containerContext=$containerManager.containerContext )  
#set( $pageManager=$containerContext.getComponent('pageManager') )  
#set( $labelManager = $action.LabelManager )  

#set( $labRef = $labelManager.getLabel($paramLabel) )  
#set( $pages = $labelManager.getCurrentContentForLabelAndSpace( $labRef, $content.spaceKey ) )  

#foreach ( $page in $pages )  
\<div class="included_page_content"\>  
\<h2\>$page.getTitle()\</h2\>  
$action.getHelper().renderConfluenceMacro("{include:$page.getTitle()}")  
\</div\>  
#end  

\<style\>  
.included_page_content {margin-bottom: 10px;}  
\</style\>


author: Denis Boisvert
body: A label sound perfect for me. I want just part of all pages. Since we use a template, I could put the label in the template. I will try this tommorow and let you know if it's working.  
Thanks!


author: Davin Studer
body: The above user macro will insert all of the contents of the pages with the label. If you only want part of the page you would tag the page with the label to identify it as a page to pull in and then wrap the content to be pulled in with an excerpt macro. And then add the below user macro to the aggregation page. It is just a modified version of the above user macro, but it uses the excerpt-include fucntionality instead of page include functionality.

**Macro Name:**   
include_excerpt_by_label

**Macro Title:**   
Include Excerpt By Label

**Template:**   
## @paramLabel:title=Label\|type=string\|required=true\|desc=Enter a label.  

#set( $containerManagerClass=$content.class.forName('com.atlassian.spring.container.ContainerManager') )  
#set( $getInstanceMethod=$containerManagerClass.getDeclaredMethod('getInstance',null) )  
#set( $containerManager=$getInstanceMethod.invoke(null,null) )  
#set( $containerContext=$containerManager.containerContext )  
#set( $pageManager=$containerContext.getComponent('pageManager') )  
#set( $labelManager = $action.LabelManager )

#set( $labRef = $labelManager.getLabel($paramLabel) )  
#set( $pages = $labelManager.getCurrentContentForLabelAndSpace( $labRef, $content.spaceKey ) )

#foreach ( $page in $pages )  
\<div class="included_page_content"\>  
\<h2\>$page.getTitle()\</h2\>  
$action.getHelper().renderConfluenceMacro("{excerpt-include:$page.getTitle()\|nopanel=true}")  
\</div\>  
#end

\<style\>  
.included_page_content {margin-bottom: 10px;}  
\</style\>


author: Vera Henrichs
body: Do you have a screenshot how this looks (and works with those labels)? Sounds interesting!