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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jul 10, 2018 in Confluence

We want to see the templates you've created in Confluence!

Hi Community, Jessica here from the Confluence Product Marketing team!  July’s community challenge is all about sharing pictures  — and as an extension of our first post on what ...

915 views 23 12
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