On Google's hreflang
documentation, in the 2-language example, it says:
Imagine you have an English language page hosted at http://www.example.com/, with a Spanish alternative at http://es.example.com/. You can indicate to Google that the Spanish URL is the Spanish-language equivalent of the English page in one of three ways:
HTML link element in header. In the HTML
<head>
section of http://www.example.com/, add alink
element pointing to the Spanish version of that webpage at http://es.example.com/, like this:<link rel="alternate" hreflang="es" href="http://es.example.com/" />
But in its 3-language example, it says:
If you have multiple language versions of a URL, each language page must identify all language versions, including itself. For example, if your site provides content in French, English, and Spanish, the Spanish version must include a rel="alternate" hreflang="x" link for itself in addition to links to the French and English versions. Similarly, the English and French versions must each include the same references to the French, English, and Spanish versions.
The above is an example for a 3-language site. My website consists of only 2 languages - the default/main ENGLISH and THAI. Do I have to add the tag for the page itself? Google's documentation is not clear about this point and in its example for 2-language site, it is not mentioned.
For example, this is what I put in http://janwawa.com/en/contact.php
<!-- GOOGLE INTERNATIONAL LANGUAGE TARGETING -->
<link rel="alternate" hreflang="th" href="http://janwawa.com/th/contact.php">
<link rel="alternate" hreflang="x-default" href="http://janwawa.com/en/contact.php">
</head>
Is the above correct? Or should I use:
<!-- GOOGLE INTERNATIONAL LANGUAGE TARGETING -->
<link rel="alternate" hreflang="en" href="http://janwawa.com/en/contact.php">
<link rel="alternate" hreflang="th" href="http://janwawa.com/th/contact.php">
<link rel="alternate" hreflang="x-default" href="http://janwawa.com/en/contact.php">
</head>
If your intention is to show them the English page for Chinese speaking users, you can indeed use your second example:
The new x-default hreflang attribute value signals to Google's algorithms that the page doesn’t target any specific language or locale and is the default page when no other page is better suited - Google
Their documentation page is somewhat lousy because they always refer to
hreflang="x"
wherex
is just a placeholder for a language tag. The language tagx
on its own is not valid, as it has to be followed by a hyphen and an alphanumeric string (x-foo
):So "[…] the Spanish version must include a
rel="alternate" hreflang="x"
link for itself […]" doesn’t make sense.x-default
is such a (valid) private language tag, and if you want to follow Google’s interpretation of it,x-default
should only be used for language-independent pages that serve as language selectors/redirectors.So neither of your examples is correct.
You should either
include only the link to the translation:
or include both, the link to the translation and the self-referencing link:
It is beyond me why Google would recommend to have a self-referencing
alternate
link in the first place, and assuming that it makes any sense, why they don’t recommend this self-referencing link in case of only two languages.HTML5 defines that the
alternate
link type references "an alternate representation of the current document". So, usingalternate
for a link to the current document doesn’t make sense, because it’s not an "alternate representation of the current document", it is the current document.Although I agree with Unor that it is not clear why Google recommend to use a self-referencing alternate
link
, Google's advice (2017) is a clear statement:For languages or locales not specified by alternate links Google says:
So, I would use another URL here.
Additionally, I would also recommended to add a
canonical
link to each page.Examples
Your English page could look like this:
Your Thai page could look like this: