Skip to content Skip to sidebar Skip to footer

Google Hreflang Language Confusion: Do I Have To Add Hreflang For The Page Itself?

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 a

Solution 1:

If your intention is to show them the English page for Chinese speaking users, you can indeed use your second example:

<!-- GOOGLE INTERNATIONAL LANGUAGE TARGETING --><linkrel="alternate"hreflang="en"href="http://janwawa.com/en/contact.php"><linkrel="alternate"hreflang="th"href="http://janwawa.com/th/contact.php"><linkrel="alternate"hreflang="x-default"href="http://janwawa.com/en/contact.php">

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

Solution 2:

Their documentation page is somewhat lousy because they always refer to hreflang="x" where x is just a placeholder for a language tag. The language tag x on its own is not valid, as it has to be followed by a hyphen and an alphanumeric string (x-foo):

privateuse    = "x" 1*("-" (1*8alphanum))

So "[…] the Spanish version must include a 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:

    <!-- on the English page <http://janwawa.com/en/contact.php> --><linkhreflang="th"href="http://janwawa.com/th/contact.php">
  • or include both, the link to the translation and the self-referencing link:

    <!-- on the English page <http://janwawa.com/en/contact.php> --><linkhreflang="en"href="http://janwawa.com/en/contact.php"><linkhreflang="th"href="http://janwawa.com/th/contact.php">

It is beyond me why Google would recommend to have a self-referencing 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, using alternate 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.

Solution 3:

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:

If you have multiple language versions of a URL, each language page should identify different language versions, including itself.

For languages or locales not specified by alternate links Google says:

For the default page that doesn’t target any specific language or locale, add hreflang="x-default".

So, I would use another URL here.

Additionally, I would also recommended to add a link to each page.

Examples

Your English page could look like this:

<linkhreflang="en"href="http://janwawa.com/en/contact.php"><!-- Alternate links are the same for all pages  --><linkhreflang="en"href="http://janwawa.com/en/contact.php"><linkhreflang="th"href="http://janwawa.com/th/contact.php"><linkhreflang="x-default"href="http://janwawa.com/default/contact.php">

Your Thai page could look like this:

<linkhreflang="th"href="http://janwawa.com/th/contact.php"><!-- Alternate links are the same for all pages  --><linkhreflang="en"href="http://janwawa.com/en/contact.php"><linkhreflang="th"href="http://janwawa.com/th/contact.php"><linkhreflang="x-default"href="http://janwawa.com/default/contact.php">

Post a Comment for "Google Hreflang Language Confusion: Do I Have To Add Hreflang For The Page Itself?"