Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,555,890
Community Members
 
Community Events
184
Community Groups

User Macro: Related Content

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}

1 comment

I haven't tested, but this is a great contribution.

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events