I am trying to create a user macro similar to content by label with a few changes in the markup along with adding pagination. But I do not know what I should be setting the contents variable to, I cannot seem to figure out how to return the results on the page.
This the code I have, What do I need to set the contents variable to and what is the syntax for doing this?
#* @vtlvariable name="contents" type="java.util.List<com.atlassian.confluence.core.ContentEntityObject>" *#
#* @vtlvariable name="excerpter" type="com.atlassian.confluence.plugins.macros.advanced.xhtml.AdvancedMacrosExcerpter" *#
#* @vtlvariable name="excerptType" type="com.atlassian.confluence.plugins.macros.advanced.xhtml.ExcerptType" *#
#* @vtlvariable name="i18n" type="com.atlassian.confluence.util.i18n.I18NBean" *#
#* @vtlvariable name="limitLabelLinksToSpace" type="boolean" *#
#* @vtlvariable name="req" type="javax.servlet.http.HttpServletRequest" *#
#* @vtlvariable name="showLabels" type="boolean" *#
#* @vtlvariable name="showSpace" type="boolean" *#
#* @vtlvariable name="staticResourceUrlPrefix" type="java.lang.String" *#
#* @vtlvariable name="title" type="java.lang.String" *#
#* @vtlvariable name="stringUtils" type="org.apache.commons.lang.StringUtils" *#
## @Param labels:title=Label|type=confluence-content|required=true
## @Param sort:title=Sort By|type=enum|enumValues=title, creation, modified|required=true
## @Param reverse:title=Reverse Sort|type=boolean|desc="Used only in conjunction with the 'Sort By parameter."
## @Param limitLabelLinksToSpace:title=Maximum Number of Pages|type=string|default=15
## @Param title:title=List Title|type=string|default=Stories by label
## @Param showLabels:title=Show Labels for Each Page|type=boolean|default=false
## @Param showSpace:title=Show Space Name for Each Page|type=boolean|default=false
## @Param excerpt:title=Excerpt Display|type=enum|enumValues=none, simple, rich content|required true|desc=How to display excerpts for each page.
## @Param showpageribbon:title=Show Page Ribbon|type=boolean|default=true
## $helper.renderConfluenceMacro("{next_previous_links:WrapAtEnd=false}")
## $helper.renderConfluenceMacro())
#if ($paramtitle)
<h3>$paramtitle</h3>
#end
#if ($contents.length() > 0)
<ul class="content-by-label">
#foreach ($content in $contents)
<li>
<div>
#contentIconWithLinkPrefix($content $staticResourceUrlPrefix)
</div>
<div class="details">
#contentHrefWithLinkPrefix($content $req.contextPath)
#if ($paramshowSpace) #contentOther($content) #end
#set ($excerptHtml = $excerpter.createExcerpt($content, $paramexcerptType) )
#if ($stringUtils.isNotBlank($excerptHtml))
<span class="smalltext"> $excerptHtml</span>
<div> this is a test</div>
#end
#if ($paramshowLabels)
<div class="label-details">
#if( $paramlimitLabelLinksToSpace )
#set( $spaceKey = $content.getSpaceKey() )
#else
#set( $spaceKey = "" )
#end
#set ($paramlabels = $content.getVisibleLabels($action.authenticatedUser))
#parse("/com/atlassian/confluence/plugins/labels/components/labels-list.vm")
</div>
#end
</div>
</li>
#end
#if ($paramshowpageribbon)
<div style="text-align:center; font-size: 14px;">
#if($pager.hasPrev)
<a href="$pager.prevLink">«</a>
#end
#foreach ($page in $pager.pages)
<a href="$page.link" class="#if($page.current) current #end">
$page.number
</a>
#end
#if($pager.hasNext)
<a href="$pager.nextLink">»</a>
#end
</div>
</ul>
#end
#else
<div class="content-by-label macro-blank-experience">
<strong class="content-label-header">$i18n.getText('contentbylabel.emptymacro.label')</strong>
<p>$i18n.getText('contentbylabel.emptymacro.content')</p>
</div>
#end