craftcms/cms

Add Site Groups

khalwat opened this issue · 8 comments

Just as there are Category Groups, there should be Site Groups.

A real conundrum I’m having is how to handle sitemaps for “multi-site”. Sitemaps have built-in support for different URLs for the same content, but in different languages. Since there’s no hierarchy for “sites”, I have no way of knowing what the association between the sites is.

So let’s say we have a corporate website that’s localized in 3 languages. That’s 3 “sites”. Then they also have 2 more “sister sites” for product brands, that are also localized in 3 languages.

We now have 9 distinct sites, but nothing expressing the relationship between any of them, so there’s no way to know which of these “sites” are localizations of the same “site”, and which are logically separate “sister sites”

So then I’d need to add some kind of “site grouping” UI that allows users can express the relationship between the sites, but that really feels like something that Craft should be doing

I think content authors in the AdminCP will have similar confusion, because of the lack of logical grouping of "things that are related" (in this case, Sites)

Will consider. For clarification, this would be closer to Field Groups than Category Groups.

Sure, Field Groups as a model for "Site Groups" just for logical grouping is more than adequate.

We are running into this issue as well, as we upgrade the Sitemap functionality of our SEO plugin. The move from Locales to Sites introduces new challenges when deciding how we know which data to output in a Sitemap. Andrew describes the problem well above. The addition of Site Groups would help solve this issue.

Google documents how to approach multiregional and multi-lingual sites here:
https://support.google.com/webmasters/answer/182192?hl=en

And here is an example of the way languages would be grouped in sitemap output:
https://support.google.com/webmasters/answer/2620865?hl=en

Site Groups could give content admins an easy way to indicate which Sites were part of the same site and which needed to be treated differently, and give plugins important information about how a user intended their sites to be grouped around potentially different domains.

While it may seem like this issue is very specific (only regarding a couple of Sitemap plugins), I think it's actually a broader issue that people will run into in a number of ways when implementing multi-site.

Could this potentially be handled by something like a global Translation Method setting – either at the Craft level or the plugin level via a Craft API (to ensure all plugins can implement it in the same way)?

Currently, a user is able to decide the Translation Method for each field:

  • Not translatable
  • Translate for each language
  • Translate for each site
  • Custom...

For something like generating an XML sitemap, we need to know how the Sites are grouped, and the Translation Method implementation already gives a very flexible method of doing this that supports locales, regions, or custom groupings. In the Sitemap case, we essentially need a Custom Translation method to group Sites at a global level for all fields that we provide in our plugin to manage the sitemap.

I agree with Andrew above that this need will not be specific to Sitemap plugins and likely come up in various ways in different multi-site implementations. Simply allowing groups may allow a user to determine one grouping at the top level while plugins have needs for different groupings with their different use cases. While the Sitemap plugin may need something like a Custom Translation Method grouping, a translation plugin may need the ability to group by language, and other plugins may have other custom needs.

Maybe the most useful thing that Craft could provide is to make sure that we could interface with Translation Methods in a way that we can display options that fit our needs, and process Custom Translation methods in a way that is consistent with how Craft is processing them.

@BenParizek Interesting idea. Can you post that as a new FR though?

Here's an "in the wild" example of someone using the custom locales route for multi-site in Craft 2.x, and he's ending up with the exact issue in discussion here for Craft 3:

nystudio107/seomatic#290

...because there's nothing grouping the sites together.