Hi All
There are only a few (5) items displayed with the Favourite Pages Macro in Confluence.
With Edit no parameters can be changed.
How can we change the number of items to be displayed with the Favourite Pages Macro?
Thxs and cheers, Manfred.
Hi Manfred,
you can't change the number of items to display, but you can add your own favorite pages user macro for that purpose:
(if you don't know, how to create a user macro, look at my article for an example)
This example is using code provided by @Davin Studer from the answer: https://community.atlassian.com/t5/Confluence-questions/Can-I-view-all-of-my-favorite-pages/qaq-p/327833
I've changed his example, so you can add a parameter for the number of items to display. And here is the code:
## Developed by: Davin Studer
## Enhanced with parameter NumberOfFavorites by Thomas Schlegel
## Date created: 06/10/2013, Date enhance: 03/08/2017
## @param NumberOfFavorites:title=Number of favorites to show pagecount|type=int|desc=Number of favourite pages to show|default=5
#set( $labelManager = $action.LabelManager )
#set( $favRef = $labelManager.getLabel("my:favourite") )
#set ($Integer = 0)
#set ($paramNumberOfFavorites = $Integer.parseInt($paramNumberOfFavorites))
#if ($favRef)
#set( $favorites = $labelManager.getCurrentContentForLabel( $favRef ) )
#set( $counter = 1)
#if ($favorites.size() > 0)
<ul>
#foreach( $favorite in $favorites )
#if ( $favorite.getType() == "page" )
#if ($counter <= $paramNumberOfFavorites)
<a href="$favorite.UrlPath">$favorite.DisplayTitle</a><br/>
#set ($counter = $counter + 1)
#end
#end
#end
</ul>
#end
#end
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You're welcome :-)
If you think, your question is answered, please mark it as answered so other users can find answered questions more easy.
Thank you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
thxs for the hint
I think this answers my question, although I won't apply it for the moment on the page I have the actual macro.
Possibly will try it first on anothter test page.
Cheers
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Thomas!
I want to "pimp" your script, e.g. the display of the spaces like the build-in macro, but I don't found a list of the methodes (like the .UrlPath or .DisplayTitle) of the Confluence API.
Does you have a link for me?
Greetings from OWL to HH!
Marc
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.