Hreflang, alternate and canonical

4

I have a website that has two versions:

link :

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

And the url link :

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

I know that I am setting the labels wrong, but I can not understand the logic that the alternate / canonical / hreflang follows for correct marking for SEO. In this case, how would you have to face the marking better? Is it enough to do it in the sitemap.xml for search engines? Ejm.:

...
<url>
    <loc>http://www.example.com/</loc> 
    <xhtml:link
        rel="canonical"
        hreflang="es"
        href="http://www.example.com/"
    />
    <xhtml:link
        rel="alternate"
        hreflang="en"
        href="http://www.example.com/en/"
    />
</url>
<url>
    <loc>http://www.example.com/en/</loc> 
    <xhtml:link
        rel="canonical"
        hreflang="es"
        href="http://www.example.com/"
    />
    <xhtml:link
        rel="alternate"
        hreflang="en"
        href="http://www.example.com/en/"
    />
</url>
...
    
asked by Inspector SEO 28.08.2016 в 21:44
source

2 answers

2

As I understand this topic you do not need to use canonical in this case, rel=canonical is to avoid duplicate content, for example when different URLs actually point to the same page, typical on the home page ::

  • www.example.com
  • example.com
  • example.com/index.html

In your case you have different languages, so the content is different, you would not need it. On the other hand you do not have to put hreflang in the canonical.

If you use canonical the url has to match the alternate one:

<link rel="alternate" hreflang="en" href="http://www.example.com/en/" />
<link rel="canonical" href="http://www.example.com/en/" /> 
    
answered by 29.08.2016 в 10:40
2

Based on my experience as an SEO:

1-The goals better put them in the header of the html, although you can put them in the sitemap, this file is a map of the website, that's where you'll have to put the internal links of your pages, there are several websites that make you the sitemap.xml if you do not use wordpress. In the sitemap you would have to put it in this way for each url that you would like to add with hreflang:

  <url>
<loc>http://www.example.com/english/</loc>
<xhtml:link 
             rel="alternate"
             hreflang="de"
             href="http://www.example.com/deutsch/"
             />
<xhtml:link 
             rel="alternate"
             hreflang="de-ch"
             href="http://www.example.com/schweiz-deutsch/"
             />
<xhtml:link 
             rel="alternate"
             hreflang="en"
             href="http://www.example.com/english/"
             />
</url>

2- The goals of hreflang is to tell Google that this URL is for that language or that region, and Google will position it in that language.

This would be the perfect example of a goal in the header of the HTML, which is where it is usually placed.

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

3-If you have several alternative URLs aimed at users of the same language, but with different regional settings. We specify the Url for each region that we want and then for the other regions we put the Url in generic English.

For this we would have to do it like this:

<link rel="alternate" href="http://example.com/en-ie" hreflang="en-ie" />
<link rel="alternate" href="http://example.com/en-ca" hreflang="en-ca" />
<link rel="alternate" href="http://example.com/en-au" hreflang="en-au" />
<link rel="alternate" href="http://example.com/en" hreflang="en" />

The most common is to put these goals in the header of html in <head></head>

The canonical thing is how Blonfu commented it is to indicate that if we have duplicate content the main URL is the one we indicated. We should never have duplicate content on our website.

    
answered by 29.08.2016 в 13:24