Closed adamseabrook closed 2 years ago
So as you mention, hreflang links are not case sensitive. Can you help me understand where the pt-BR
is ever output?
SEOmatic should be consistent, in terms of outputting both <link rel="alternate" hreflang="pt-br">
as well as the hreflang link in the sitemap being "pt-br"
.
I'm a little confused as to how Ahrefs shows multiple localizations of the same page, that being the case?
Is the mixed case variant being output somewhere/somehow?
SEOmatic does not seem to output the hreflang in different cases. All it is doing is lowercasing the "proper" hreflang that Craft shows in the Language drop down in the settings > sites section. They show it as xx-XX
and that does seem to be the way most sites show it vs xx-xx
.
So not really a bug but for consistency I feel it should respect the casing set by Craft and not lowercase it. I actually rarely see the hreflang lowercased on large multi-lingual sites. Struggling to actually find an example of lowercase.
Ahrefs should be ignoring the case but they do not. Instead they show it like this for https://www.zarla.com/privacy-policy
where they report the xx-XX
in the source and then additional for the SEOmatic generated sitemaps as xx-xx
. I plan on logging this bug with them also.
Google uses all lowercase in a number of their examples:
https://developers.google.com/search/docs/advanced/crawling/localized-versions
Link: <https://example.com/file.pdf>; rel="alternate"; hreflang="en",
<https://de-ch.example.com/file.pdf>; rel="alternate"; hreflang="de-ch",
<https://de.example.com/file.pdf>; rel="alternate"; hreflang="de"
The official spec for the tag also mentions that it is case-insensitive so... I'm not really sure I'd qualify this as a bug in SEOmatic.
In contrast, SEOmatic does explicitly uppercase the regional code for OpenGraph:
https://github.com/nystudio107/craft-seomatic/blob/develop/src/helpers/Localization.php#L27
I feel like this is a Ahrefs issue, it should be treating the tag attributes as case insensitive. I'd be open to revisiting this if they come back with something to the contrary, though.
Describe the bug
With the
Sitemap Alt URLs
option turned on it adds all the alternate language versions of the page to the sitemap. A Craft Site Language Setting ofpt-BR
shows aspt-br
in the sitemap (have to view source to see it). I know that hreflang isn't case sensitive but it throws off the site audit crawl Ahrefs does as it shows as two alternate pages when it is really just the one. It also causes issues with some other audit tools that are case sensitive.To reproduce
pt-BR
or any language and region combination.Sitemap Alt URLs
Expected behaviour
Hreflang case set at the Craft Site level should be respected.
Screenshots
For example https://www.zarla.com/sitemaps-1-section-categoryDirectoryListing-3-sitemap.xml
Should be
pt-BR
,nl-NL
,tr-TR
,pl-PL
, andid-ID
.Versions