Confluence had a list of shared user macros (which can't be updated anymore). I found one that was useful however doesn't currently work in Confluence:
https://confluence.atlassian.com/display/DISC/Related+Content
I updated it (likely there is still work to be done to it, not sure if I'll put more effort though) and thought of returning the favor by sharing the new version back to the community as it was intended. If I happen to update it, I'll update it on this post as well.
So here goes:
=============================
## @Param labels:title=Labels|type=string|desc=Comma-separated list of additional labels
## @Param author:title=Author|type=username|desc=Filter by author.
## @Param type:title=Document Type|type=enum|enumValues=page,blogpost|desc=Only show documents matching this type.
## @Param showLabels:title=Show Labels for Each Page|type=boolean
## @Param showSpace:title=Show Space Name for Each Page|type=boolean
## @Param title:title=List Title|type=string
## @Param maxResults:title=Maximum number of Pages|default=5|type=string
## @Param excerpt:title=Excerpt Display|type=enum|enumValues=none,simple,rich content|desc=How to display excerpts for each page.
## @Param space:title=Space|type=spacekey|desc=Filter by space.
## @Param sort:title=Sort By|type=enum|enumValues=title,creation,modified
## @Param reverse:title=Reverse Sort|type=boolean|desc=Used only in conjunction with the 'Sort By' parameter.
#set($wiki="")
#set($globalHelper=$action.getHelper())
#if($content) ## i. e. we render a normal page
#set($renderer=$globalHelper.getWikiStyleRenderer())
#set($context=$content.toPageContext())
#set($labelList=$content.getGlobalLabels($action.getRemoteUser()))
#if($labelList.size() > 0)
#set($labels="")
#foreach( $label in $labelList )
#if($labels == '')
#set($labels="'"+$label+"'")
#else
#set($labels=$labels+","+"'"+$label+"'")
#end
#end
#if($paramlabels)
#set($labels=$labels + ", " + $paramlabels)
#end
#set($wiki="{contentbylabel:cql=")
#set($wiki=$wiki + "label in ($labels)")
#if($paramauthor)
#set($wiki=$wiki + "|creator=$paramauthor")
#end
#if($paramtype)
#set($wiki=$wiki + "|type=$paramtype")
#end
#if($paramshowLabels)
#set($wiki=$wiki + "|showLabels=$paramshowLabels")
#end
#if($paramshowSpace)
#set($wiki=$wiki + "|showSpace=$paramshowSpace")
#end
#if($paramtitle)
#set($wiki=$wiki + "|title=$paramtitle")
#end
#if($parammaxResults)
#set($wiki=$wiki + "|max=$parammaxResults")
#end
#if($paramexcerpt)
#set($wiki=$wiki + "|excerptType=$paramexcerpt")
#end
#if($paramspace)
#set($wiki=$wiki + "|space=$paramspace")
#end
#if($paramspaces)
#set($wiki=$wiki + "|space=$paramspaces")
#end
#if($paramsort)
#set($wiki=$wiki + "|sort=$paramsort")
#end
#if($paramreverse)
#set($wiki=$wiki + "|reverse=$paramreverse")
#end
#set($wiki=$wiki + "}")
#end
#set($xhtml=$renderer.convertWikiToXHtml($context, $wiki))
#else ## we are e. g. in Global Template Preview
#set($xhtml=$globalHelper.renderConfluenceMacro($wiki))
#end
## remove leading <p> and trailing </p>
#if($xhtml.startsWith("<p>",0) && $xhtml.endsWith("</p>"))
#set($len=$xhtml.length()-$generalUtil.convertToInteger(4))
#set($xhtml=$xhtml.substring(3,$len))
#end
${xhtml}
Federico Vecchiarelli
Join the largest European gathering of the Atlassian Community and reimagine what’s possible when great teams and transformative technology come together. Plus, grab your Super Fan ticket now and save over €1,000 on your pass before prices rise on 3 June.
Register nowOnline forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
1 comment