How to aggregate the contents of certain section of a page on one page?

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.

1 answer

0 vote
Davin Studer Community Champion Jan 30, 2014

Would the include-excerpt or include page macros fulfill what you are trying to do?

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.

Davin Studer Community Champion Jan 31, 2014

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>

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!

Davin Studer Community Champion Feb 03, 2014

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>

Do you have a screenshot how this looks (and works with those labels)? Sounds interesting!

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Confluence

Three common content challenges + how to manage them

An efficient enterprise content management system, or ECM, is a must-have for companies that create work online (cough   cough, all companies). If content calendars, marketing plans, and bu...

80 views 0 5
Read article

Atlassian User Groups

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!

Find my local user group

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

Groups near you