How can I make my favorite spaces appear alphabetically on my dashboard

I just upgraded to Confluence 5.9.7. I like how I can see my favorite spaces on my dashboard, but don't like how they aren't organized alphabetically. Anyone know how? 

2 answers

0 vote
Stephen Deutsch Community Champion Apr 05, 2016

You could insert the following in your custom HTML:

<script>
//Sort My Spaces on the dashboard in alphabetical order
AJS.toInit(function() {
    if ($("body").hasClass("dashboard")) {
        $( document ).ajaxComplete(function( event, xhr, settings ) {
			if ( settings.url.indexOf("search?cql") > 0 ) {
				var mySpaces = $("#sidebar-spaces > div > ul > li").detach();
				mySpaces.sort(function (a, b) {
					return $(a).find('.aui-nav-item-label').text() > $(b).find('.aui-nav-item-label').text() ? 1 : -1;
				});
				$("#sidebar-spaces > div > ul").append(mySpaces);
			}
		});
    }
});
</script>

Thanks so much, Stephen!

That script does not have any effect in my environment. I tried all three custom HTML sections available. Any other idea?

Where do we put this code?

Stephen Deutsch Community Champion Nov 04, 2016

To include JavaScript inside Custom HTML, go to Confluence Admin > Custom HTML and insert the code in the "At end of the HEAD" textbox.

https://confluence.atlassian.com/confkb/how-to-use-javascript-in-confluence-313458839.html

Code didn't work for us either. on Confluence 5.10.0

Stephen Deutsch Community Champion Nov 04, 2016

I see now that it was loading the spaces dynamically. The updated code should work (but it will only work for 5.10 and below, it won't work for 6.0).

That worked great! thank you.

I have the same question for Cloud.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Kesha Thillainayagam
Posted Apr 13, 2018 in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

2,821 views 27 11
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