2

I read so many tutorials about canonical and alternate x-default, but I am still not a 100 per cent sure if this is correct:

I have a multi language page that is structured like this:

https://www.example.com/lang

etc.

User visiting https://www.example.com will be 301-redirected to the appropriate language (/de, /en, /fr, /it etc.) OR to /en if no better language is found.

This means that www.example.com will never render to the user but always redirect. Is it now correct to:

Is it correct to include rel="alternate" of all languages PLUS a canonical link to www.example.com into the language sub sites (/de, /en, /fr) etc.? AND: Should there be a x-default linked to the main domain (without subfolder)? Or should the x-default go to /en

I just can't figure it out. I have not found any consistent explanation for this so far.

0

2 Answers 2

6

It is a confusing state of affairs, but here are some pointers:

Don't use the canonical tag in the way you were thinking. Content translated into several languages is not duplicate content. So you don't want to be pointing /fr/ --canonical--> /en/ at all. Use rel="alternate" hreflang="en" instead. Use canonical within a given language to account for duplicates. Example:

www.example.com/en/page1.html
www.example.com/en/page1.html?somerandomparameter=4
www.example.com/fr/page1.html
www.example.com/fr/page1.html?somerandomparameter=4

You should use two canonical tags:

en/page1.html?somerandomparameter=4 --> en/page1.html
fr/page1.html?somerandomparameter=4 --> fr/page1.html

Note that the French page never points to a canonical English version. To deal with the language difference, we use reciprocal hreflang tags as well:

fr/page1.html <--> en/page1.html

Another important aspect to hreflang is that a page should refer not just to the other languages, but to itself as well. So, on the English-language page, you would have:

 <link rel="alternate" hreflang="en" href="www.example.com/en/page1.html" />
 <link rel="alternate" hreflang="fr" href="www.example.com/fr/page1.html" />

Putting it all together, here are the canonical and hreflang tags for my example. I've listed the page, and then indented are all the tags that should be in the source code of that page:

www.example.com/en/page1.html
    <link rel="alternate" hreflang="en" href="www.example.com/en/page1.html" />
    <link rel="alternate" hreflang="fr" href="www.example.com/fr/page1.html" />
www.example.com/en/page1.html?somerandomparameter=4
    <link rel="canonical" href="www.example.com/en/page1.html" />
www.example.com/fr/page1.html
    <link rel="alternate" hreflang="en" href="www.example.com/en/page1.html" />
    <link rel="alternate" hreflang="fr" href="www.example.com/fr/page1.html" />
www.example.com/fr/page1.html?somerandomparameter=4
    <link rel="canonical" href="www.example.com/fr/page1.html" />

Note that the parameterised pages don't need to hreflang each other: Google follows the canonical instruction in each case, and then realises that there are multiple versions of page1.html across various languages.

Finally, it isn't ideal to 301-redirect visitors based on their browser language preference or location. Googlebot always crawls from the US, and doesn't express a preference for any language other than English. Forcing a 301-redirect can mean Googlebot spends most of its crawl budget on the English-language pages, and may never even see the other languages. Make sure that Google can at least reach those other language subfolders -- is your language selector crawlable?

Edit 1: I just realised I didn't answer the part of your question about x-default. In your case, given that you're redirecting users to the /en/ subfolder (i.e. nobody is really going to use the root folder), then your x-default should be www.example.com/en/, not www.example.com

Edit 2: I do understand your concern there, but I'd still recommend using x-default to point to the /en/ folder. The reason being that this actually describes the way your site works more accurately: your root folder doesn't really have a language at all -- it just serves as a redirect. The behaviour of your site is such that English is truly functioning as the default language, and your hreflang should reflect that. After all, as you've said, when you can't find a better language for them you send the user to the /en/ folder.

Google shares your aim of serving language-specific content, and rely on your x-default as a signal. If your site had only French, English, and Spanish versions, and the user is a German speaker searching on Google.de, it makes more sense for the /en/ page to show up in Google's results. That makes for a more straightforward user experience -- that's the default language, and the user gets sent straight to it -- rather than Google sending them to a page that only functions as a redirect to English content anyway. Also, the user doesn't have to wait for a redirect, which speeds things up and improves the experience.

Basically, you probably want to minimize direct traffic to the root folder. Configure your x-default to /en/ and let Google do the work of per-user language selection for you.

6
  • 1
    Thanks so much! Your "EDIT:" was the bit I was worried about the most. I have a follow up about this: I am only redirecting users from / to /en if I DO NOT find a better language for them. Are you sure x-default should not point to / as that is the page that NOT targeted to specific language. So when a user searches google and finds my site but is no speaker of any of the subfolder languages, I would want him to go to / rather than english. On / the site determines the best language for him. Commented Nov 19, 2015 at 8:57
  • Hey @ArminHierstetter, I've updated the answer to try and address that. See 'Edit 2'.
    – Stephan
    Commented Nov 19, 2015 at 11:43
  • Hey, @Stephan, Thank you very much. You have been unbelievably helpful. It looks like quite a complex topic, but once you understand what those things try to achieve, its true beauty shines. Commented Nov 19, 2015 at 15:14
  • I'm glad you found it useful. This is still an area where a lot of people feel uncertain, and not everything is well-documented. Could you mark the answer as 'accepted'? It makes it easier for others to find a relevant answer if they have the same kind of question.
    – Stephan
    Commented Nov 20, 2015 at 14:04
  • 1
    Done! (well, actually 5 years ago) … thanks again. Commented Jan 7, 2021 at 20:59
2

Google's documentation clearly states

For language/country selectors or auto-redirecting homepages, you should add an annotation for the hreflang value "x-default"

So in this case your x-default should be www.example.com and not www.example.com/en/.

To simplify the answer, your use case does not seem to indicate any need for rel=canonical at all. You should be fine with using only Hreflang. You can test your implementation of Hreflang tags here.

1
  • I wouldn't say "clearly", it clearly states that if you have a language selection page that is "language agnostic" then you should advertise it in x-default, it never states explicitely to adversite a blank url (no language selected). It also never explains how you should handle cases where www.example.com can't be reached (when there is a redirection to the default language, like for example www.example.com/en/). To me it doesn't make a lot of sense to advertise a page that doesn't really exist, but that doesn't mean its not the right way. Its just not "clear" in your source.
    – cglacet
    Commented Dec 28, 2023 at 11:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.