Number of items in Favourite Pages Macro

Manfred Zuber August 3, 2017

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.

1 answer

1 accepted

0 votes
Answer accepted
Thomas Schlegel
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 3, 2017

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
Manfred Zuber August 3, 2017

Hi Thomas and thxs very much for your prompt answer!

Thomas Schlegel
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 4, 2017

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.

Manfred Zuber August 4, 2017

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

Marc Hornschuh March 28, 2018

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

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events