2

I know this kind of questions have been answered a thousand times, but you know that every question is different in some sort of way :)

So, I'm having troubles with Google Indexing my site correctly. The website sitemap is as follows:

| - example.com
| --- example.com/es
| --- example.com/en

mysite.com acts as a bridge redirecting depending on the "HTTP_ACCEPT_LANGUAGE" header to one or the other ("en" is set to default). I've been told that googlebot doesn't send quite often this header so this might be a problem (?).

Pretty common setup, right? Well, the problem is that despite having hreflangs integrated on every page and having the alternate versions in the sitemaps, Google keeps indexing no matter the language of the browser always the English version (thus including the description of the page and the title besides the url). Furthermore, it always displays the root domain instead of the language sites (as Ryanair does for example).

To better understand what I'm trying to achieve I'll describe the way I want Google to display the results:

When searching from a Spanish web browser I'd like to display the Spanish content: title and description (quite obvious duh :P) as well as the Spanish url: "example.com/es". And the same with the English version with browsers not being Spanish. To be fair I don't even understand either why it keeps replacing the titles to "MYNAME : REST OF TITLE" instead of "MYNAME - REST OF TITLE".

I have this sitemap in the root domain (it is a sitemap index):

   <sitemap>
      <loc>https://example.com/es/sitemap.xml</loc>
   </sitemap>

   <sitemap>
      <loc>https://example.com/en/sitemap.xml</loc>
   </sitemap>

And this is the english sitemap just that you can see how it's done:

<urlset
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:example="http://www.example.com/schemas/example_schema"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
<!-- namespace extension -->

<url>
    <loc>https://example.com/en/</loc>
    <xhtml:link rel="alternate" hreflang="es" href="https://example.com/es/"/>
</url>
<url>
    <loc>https://example.com/en/linkEnglish/</loc>
    <xhtml:link rel="alternate" hreflang="es" href="https://example.com/es/linkSpanish/"/>
</url>
<url>
    <loc>https://example.com/es/</loc>
</url>

And then this is written in every single page inside the header:

<!-- hreflang -->
<link rel="alternate" href="https://example.com/es" hreflang="es" />
<link rel="alternate" href="https://example.com/en" hreflang="en" />

Any suggestion in how can I accomplish this?

Thank you very much in advance!

1

I see 3 issues here.

1. You are missing the self referencing hreflang from the XML sitemaps.

As with using the tags in the pages source code, you need to reference every alternate version of the page, including itself.

So it should look like:

<url>
    <loc>https://example.com/en/</loc>
    <xhtml:link rel="alternate" hreflang="es" href="https://example.com/es/"/>
    <xhtml:link rel="alternate" hreflang="en" href="https://example.com/en/"/>
</url>

2. You are using hreflang tag mark up in both the source code and in XML sitemaps.

You should only use 1 or the other, not both. So it looks like the mark up is correct in the source, but not in the XML sitemaps as mentioned above, so perhaps Google is using the mark up in the XML sitemap and ignoring the tag in the code.

It doesn't matter which you use, source code or XML sitemaps, choose which ever is easiest to maintain, but only choose 1.

3. Missing X-default href lang tag

When you have auto-redirecting homepages, you should implement the hreflang tag "x-default" for these pages. This tag needs to be on every alternate version and have a self referencing as mentioned above.

The implementation would look like

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

You can use the x-default either in the source code, or XML sitemaps implementation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.