I recently set up a Multi-site using Craft CMS and because I’m an information junkie, I figured why not write it down.
This multi-site set up was to be used for multiple languages on a Craft CMS (version 3) platform.
- Once your main site is set up you can set up the second (or more) sites by navigating to “Settings > Sites > + New Site”. In this example our second site was going to be a Spanish language site named “Espanol” (sorry I didn’t even attempt to use the ñ in the site name or handle).
- The settings for the new site were set up as follows — Set the New Site name (Espanol), handle (espanol), language (es — Spanish), and base URL (web/es)
- Once you have the second site set up then you will need to enable that new site in each individual site section.
Navigating to “Settings > Sections “— enable the new site and enter the entry URI format and template (you can use the same templates or different ones from the main site)
One of the more confusing properties that needs to be set is the “ Propagate entries across all enabled sites? ”
If you check this box all of the entries and any fields you have assigned in those entries will be copied to the second site. If this is enabled and you create a new entry on the English site a corresponding/identical entry will be created on the Spanish site. You will be able to change the content of that entry independent of each site but if you add or remove fields from one site they will be subsequently added or removed from all sites. This is useful if you are doing a direct 1:1 translation and you want the sites to be all but identical.
If you leave this unchecked you will have to add entries by hand as well as add any fields by hand. If the structure of the entries is going to be different between the multiple sites you are going to want to keep this setting disabled.
- Next you will need to update the settings under “Settings > Fields”. For each field you can set the translation method. — each language = different content per sites for each language (you may have multiple sites with the same language and want to base your content per those languages) — each site = different content per site (despite the language set per site you want different content based on the site itself) — each site group = different content per sites group sites (you may wish to group sites and base the content on that group) — not translatable = content will be the same across all sites/languages
However, some fields you cannot set the translation method:
Matrix — can only be set per block inside the matrix, selecting a per-site basis will override whatever the individual blocks are set as
Neo — cannot be set at all, must manage these blocks on a per-site basis (aka re-add the appropriate blocks per entry on every site, this means it may or may not mirror the main site depending on how you re-add your blocks)
- At the top of the “Entries” view there is a select box where you can choose which site you want to edit entries. Changing this drop down will change the structure of entries displayed below. I believe this setting also persists when you log out and log back in, something to note when you re-enter the dashboard and begin editing entries, you may be edit entries on a second site rather than the main site you intended to edit.
- When you are editing an entry you can also switch between sites from the drop down at the top of that individual entry. This is the same drop down that will show you the available versions of the entry.
- An icon will appear next to each field that can be translated on the other sites in your multi-site set up.
It seems like nothing else needs to be set up to get this running, though everything I’ve found online expects you to create a new web folder with a new index.php for each new site. This seems to function without that, as long as you don’t need any template customization for each new site. Craft figures out which content to use based on the set url for that site.
You can use the same templates for everything, set up separate templates per site, or use the same templates with conditionals per language. All in all it is very flexible.