You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
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}