Automatic language detection and canonical URLs

Hi all,

our client is having problems indexing the start page of their website. It’s a multilingual site with automatic language detection.

The problem is that Google Search Console indexes https://example.com instead of https://example.com/de and marks the URL with language suffix as a duplicate.

I have since added the localised version as canonical but Google Search Console insists that the version it picked as canonical (without /de) fits better.

Also I am wondering why https://example.com is indexed at all when it is redirected to either /de or /en anyway.

Maybe someone with more SEO knowledge can shed some light on this?

I just checked in our code and the automatic language redirect is using a 302. I’m not a SEO expert myself, but it might make sense to change that to a 301.

Thank you Bastian. We dug a little deeper and also found the 302 to be the likely reason for the issue.

Google recommends to set up a generic page with a language selector for https://example.com. That page should be referenced using the x-default hreflang attribute along with localised hreflang tags for each language version:

I’d like to avoid a language selector page and I’m not sure if there’s a provision for such a thing in Kirby’s auto-detection… I’m also interested in the impact of simply adding one of the localised versions, e.g. https://example.com/en as x-default.

Regarding 301 vs. 302 I found conflicting opinions on the web. 302 does seem standard practice for language redirects, though…

For context: we’re using this sitemap plugin https://github.com/isaactopo/xmlsitemap which only lists pages with language suffix. Non-localised pages (including https://example.com) do not show up at all…