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 votes
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
Community showcase
Published yesterday in Confluence Cloud

Happy holidays from our team to yours!

Hi Community!  2018 was filled with changes for our team, both big and small, and we've taken a lot of time to both celebrate our wins and recognize areas of improvement. One thing that we're a...

103 views 1 14
Read article

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