3

I am not sure if I understand how to use hreflang="x-default"

I have a website with two languages. In the head of each page I have a link to each language. For instance:

<link rel="alternate" hreflang="en" href="http://example.com/about" /> 
<link rel="alternate" hreflang="fr" href="http://example.com/fr/about" />

I have the page "language" To help people choose the language. It has two buttons. One to go to the home page in English and the other button to go to the home page in French.

Do I need to include in each page a link to "language"?

<link rel="alternate" hreflang="x-default" href="http://example.com/language" />
1

Yes, the hreflang="x-default" tag is used for language/country selector pages such as the page you describe.

But ensure to define every alternate link and a self referencing link on each page, so your mark up would look like:

http://example.com/language

<link rel="alternate" hreflang="en" href="http://example.com/about" /> 
<link rel="alternate" hreflang="ca" href="http://example.com/fr/about" />
<link rel="alternate" hreflang="x-default" href="http://example.com/language" />

http://example.com/about

<link rel="alternate" hreflang="en" href="http://example.com/about" /> 
<link rel="alternate" hreflang="ca" href="http://example.com/fr/about" />
<link rel="alternate" hreflang="x-default" href="http://example.com/language" />

http://example.com/fr/about

<link rel="alternate" hreflang="en" href="http://example.com/about" /> 
<link rel="alternate" hreflang="ca" href="http://example.com/fr/about" />
<link rel="alternate" hreflang="x-default" href="http://example.com/language" />

Also did you mean to use the language code ca? As that is Catalan language which is mostly spoken in Spain (although also in some parts of France, so perhaps valid in your case)

More info on hreflang tags from Google here: https://support.google.com/webmasters/answer/189077?hl=en

| improve this answer | |
  • Sorry, I mixed two languages there. It should be: <link rel="alternate" hreflang="fr" href="example.com/fr/about" /> – Nrc Feb 20 '17 at 14:34
  • So, If I understand, I should use x-default in all the pages and it should go to a page to choose the language? Did I understand right? – Nrc Feb 20 '17 at 14:36
  • Correct. So you have the same set of mark up on every page. – Max Mar 3 '17 at 4:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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