Why it matters
- A sitemap can give Google the language versions of a page with
xhtml:linkelements. Google asks that each page list all its versions, itself included, and that every version list the others: if one page does not list the other back, Google may ignore the pair. - A language or region code Google does not accept (
ara,en-UK,ar_SA) is skipped, and that version is not matched. - A version must be a full address with
https://, as a sitemap gives them all.
Example
<xhtml:link rel="alternate" hreflang="ar" href="https://shop.example/ar/oud"/> <xhtml:link rel="alternate" hreflang="en-UK" href="https://shop.example/en/oud"/>
<xhtml:link rel="alternate" hreflang="ar" href="https://shop.example/ar/oud"/> <xhtml:link rel="alternate" hreflang="en" href="https://shop.example/en/oud"/>
How to fix
Give every page of a group the same list, each with its own address in it:
html
<url>
<loc>https://shop.example/ar/oud</loc>
<xhtml:link rel="alternate" hreflang="ar" href="https://shop.example/ar/oud"/>
<xhtml:link rel="alternate" hreflang="en" href="https://shop.example/en/oud"/>
</url>
<url>
<loc>https://shop.example/en/oud</loc>
<xhtml:link rel="alternate" hreflang="ar" href="https://shop.example/ar/oud"/>
<xhtml:link rel="alternate" hreflang="en" href="https://shop.example/en/oud"/>
</url>- Declare the
xhtmlnamespace on theurlset(xmlns:xhtml="http://www.w3.org/1999/xhtml"). - Use the codes the hreflang generator writes:
ar,ar-SA,en,en-GBandx-default. - Write full addresses, the same ones as the
locof the pages they point to. - Use hreflang in the sitemap or in the pages, not both with different answers.
How we detect
- We read the sitemaps the scan fetched that are a
urlset, the first 5,000 entries of each, and thexhtml:linkelements withrel="alternate"and anhreflangin them. - The
no-selfmessage: a page that lists alternates but none is its own address. - The
no-returnmessage: a page lists a version which is itself an entry of the same file, and that entry does not list the page. A version that is not in this file may be in another sitemap and is not judged. - The
bad-codemessage uses the same check as the hreflang code check on pages; therelativemessage is an address that does not begin with http:// or https://. - One finding for each message and sitemap, with how many and the first.