Number of items in Favourite Pages Macro

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

Accepted Answer
0 votes
Thomas Schlegel Community Champion Aug 03, 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

Hi Thomas and thxs very much for your prompt answer!

Thomas Schlegel Community Champion Aug 04, 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.

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

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
Community showcase
Posted Thursday in Confluence

What are your project planning tips?

Hello Community,  Jessica here from the Confluence product marketing team! Today I wanted to get your takes on project planning –– what works, what doesn’t, how do you know if you’re doing it r...

165 views 0 3
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you