[FR] x-default site setting
Is your feature request related to a problem? Please describe.
It looks like the x-default link tag is tied to the primary site setting in Craft. We'd like the default to be set to our international site version. However, our US site has cart functionality and most of the business logic in our module pertains to commerce on the US site, so it would be preferable to set the primary site to the US version.
Describe the solution you would like
It would be nice to have an additional setting when the Include x-default hreflang Tag is enabled. It could be a dropdown that defaults to Use Craft primary site setting, but also provides sites to be individually selected in cases like ours where we'd like the primary site to be different than x-default.
Describe alternatives you have considered
In the short term, we'll probably work around this by manually setting x-default in Twig templates. However, long term it would be nice to have this setting option to help simplify the amount of manual overrides in templates.
I'm a bit on the fence here, because it feels like you should set the primary site in Craft to be whatever the primary site on the frontend is set to.
I think the x-default hreflang tag has a slightly different purpose than a primary site in Craft.
Primary in the context of Craft could mean any number of things. For us, we set US English as our primary site because that's our primary market, and because we sell B2C using Commerce within the US.
The x-default hreflang tag is used to specify the language and region fallback for a page when the site doesn't support the user's language and region. In our case, we want the fallback to be our generic, international English site because we don't sell B2C outside the US, so we want to avoid confusion by not directing potentially international users to a site with cart functionality they can't actually use.
I can see how in many cases there probably would be a lot of overlap between Craft's primary site and the x-default hreflang tag, but I don't think that's necessarily always the case.
Well, worst case, you can always manually override any of these hreflang settings, or exclude them entirely and render them yourself.
Implemented in the above commits.
There is now a x-default site setting in SEOmatic -> Plugin Settings -> Tags:
Craft CMS 3:
You can try it now by setting your semver in your composer.json to look like this:
"nystudio107/craft-seomatic": "dev-develop as 3.4.78”,
Then do a composer clear-cache && composer update
…..
Craft CMS 4:
You can try it now by setting your semver in your composer.json to look like this:
"nystudio107/craft-seomatic": "dev-develop-v4 as 4.0.50”,
Then do a composer clear-cache && composer update
…..
Craft CMS 5:
You can try it now by setting your semver in your composer.json to look like this:
"nystudio107/craft-seomatic": "dev-develop-v5 as 5.0.4”,
Then do a composer clear-cache && composer update