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

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?

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

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.

is there an update which works Confluence 6.10?

I have the same question for Cloud.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Mar 12, 2019 in Confluence

Confluence Admin Certification now $150 for Community Members

More and more people are building their careers with Atlassian, and we want you to be at the front of this wave! Important Dates Start the Certification Prep Course by 2 April 2019 Take your e...

1,186 views 2 13
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