The Craft 3 multi-sites is very useful. However, I found the list dropdown while editing an entry confusing and awkward in my case.
I have several sites group, each containing a localized version of the site version:
- International Sales
- English version
- Production
- English version
- French version
— Distribution
- English version
- French version
I could have set the sites group like this, to get the right display name when looping on each sites (using craft.app.sites.getAllSites()
):
- International Sales
- International Sales
- Production
- Production
- Production
— Distribution
- French Distribution
- Distribution France
But as you can see, there's almost nothing that inform the user which site version is using which locale, when editing the sites from the CP's dropdown.
So I had to change each name by something like this:
- International Sales
- International Sales → English
- Production
- Production → English
- Production → French
— Distribution
- Distribution France → English
- Distribution France → French
Now I'm facing two problems:
How can I set an ordered list of all sites using Twig? Because
craft.app.sites.getAllSites()
loop through sites using an alphabetical order, like in the CP. For example, I would like the Distribution group displayed before the Production group.How can I set a display name different from the site name? Because International Sales → English, Production → English, etc. are ugly names, only for visual reference in the CP. I would like to display their names like in the second version of the list: International Sales, French Distribution, etc.