We have 38 sites running, divided over 6 groups. But for some weird reason on showing the sites list, 10 sites are showing up random. How can we fix this, or how can we order the sites on 'name' or 'id'?

{% set sites = craft.app.sites.allsites() %}
{% for site in sites %}
    {{ site.name }}<br>
{% endfor %}

enter image description here


1 Answer 1


I've seen that before, if you look at the sites table in your DB, you'll see that a few sites might have their sortOrder set to 1.

If you go to Settings → Sites → [the offending group] in your Control Panel, try to reset the order of your sites in there (drag/drop using the little handle to the right of each site row), it should stop them showing up in a random order on the front end.

  • Oliver, you hero! You are 100% correct, it was that these 10 sites all had sortOrder 1 Commented May 31, 2019 at 8:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.