Google hreflang language confusion: do I need to add hreflang for ITSELF page?

The Google hreflang

documentation
, the example of two languages spoken:

Imagine you have an English page hosted at http://www.example.com/ with a Spanish alternative at http://es.example.com/ . You can tell Google that the Spanish URL is the English equivalent in English in one of three ways:

  • HTML link element in the header. In the http://www.example.com/ section in the HTML, <head>

    add an element link

    pointing to the Spanish version of this web page at http://es.example.com/ , for example:

    <link rel="alternate" hreflang="es" href="http://es.example.com/" />
    
          

But in his trilingual example, he 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 should include rel = "alternate" hreflang = "x" for itself, in addition to links to the French and English versions. Likewise, the English and French versions must include the same links to the French, English and Spanish versions.

The above is an example for a 3-language site. My site consists of only two languages ​​- default / main ENGLISH and THAI. Do I need to add a tag for the page itself ? The Google documentation is not entirely clear on this matter, and it is not mentioned in its example for a bilingual site.

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 it 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>

      

+3


source to share


3 answers


If you intend to show them an English page for Chinese speaking users, you can actually use your second example:

<!-- 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">

      



The new value for the hreflang x-default attribute indicates to Google algorithms that the page does not target any particular language or locale and is the default page when another page does not fit best - Google

0


source


Their documentation page is somewhat disgusting because they always refer to hreflang="x"

, where x

is just a placeholder for the language tag. The language tag x

itself is invalid because it has a hyphen followed by an alphanumeric string ( x-foo

):

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

      

So, [...] the Spanish version should contain a link rel="alternate" hreflang="x"

for itself [...] "doesn't make sense.

x-default

is such a (valid) private language tag, and if you want to follow Google's interpretation, x-default

should be used for language independent pages that serve as language selectors / redirectors .

So, none of your examples are correct.



You must either

  • includes only translation link:

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

  • or include both translation links and self-reference link:

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

It is beyond my power why Google would recommend having a link for links alternate

in the first place and believing that it makes sense why they do not recommend this link for links, unless in two languages.

HTML5 defines that the link type alternate

refers to an "alternate representation of the current document". Thus, alternate

it makes no sense to use it to refer to the current document, since it is not an "alternate representation of the current document", it is the current document.

0


source


While I agree with Unor that it is not clear why Google recommends an alternative link

, Google's Tip (2017) is a clear statement:

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

For languages ​​or locales not listed by alternate links, Google says:

For a default page that does not target any particular language or locale, add rel = "alternate" hreflang = "x-default".

So, I would use a different url here.

Also, I would also recommend adding a link canonical

to every page.

<strong> Examples

Your English page might look like this:

<link rel="canonical" hreflang="en" href="http://janwawa.com/en/contact.php">
<!-- Alternate links are the same for all pages  -->
<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/default/contact.php">

      

Your Thai page might look like this:

<link rel="canonical" hreflang="th" href="http://janwawa.com/th/contact.php">
<!-- Alternate links are the same for all pages  -->
<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/default/contact.php">

      

0


source







All Articles