Uffo Uffo - 4 months ago 15
HTML Question

hreflang issue from webmaster tools

So I use href lang ONLY on my INDEX page, like this:

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


But I keep getting these errors in google webmaster tools


Google has detected that some pages on your site have implemented the
rel-alternate-hreflang tag incorrectly. In particular, there seems to
be a problem with incorrect language and region codes, or incorrect
bi-directional linking (if page A links with hreflang to page B, there
must be a link back from B to A as well). Google uses the hreflang
attributes to serve the correct language or regional URL to the right
users in search results. Until you correct the errors on the hreflang
links, your website will not benefit from additional language or
region targeting.


I don't understand why? I searched alot and can't seem to find an answer.

Answer

If you don't have any pages with locales listed, then just use x instead of x-default (or indeed the language-code, e.g. en/de etc.)

Usually you would use hreflang=x-default in a a set like this (note the several locales indicated in the alternate pages)

<link rel="alternate" hreflang="x-default" href="http://www.example.com/" />
<link rel="alternate" hreflang="en-gb" href="http://en-gb.example.com/page.html" />
<link rel="alternate" hreflang="en-us" href="http://en-us.example.com/page.html" />
<link rel="alternate" hreflang="en" href="http://en.example.com/page.html" />
<link rel="alternate" hreflang="de" href="http://de.example.com/seite.html"/>

Footnote: I found a handy hreflang generator tool here

I suggest you request this as a topic/addition here - could be useful!