Should I be using both "rel=canonical" and "rel="alternate" within my sitemap?

by olimits7   Last Updated March 04, 2016 01:01 AM

I followed this setup in my sitemap that Google outlines on this page: https://support.google.com/webmasters/answer/189077?hl=en .

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

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

However, should I also be including a "rel=canonical" tag like the following?

<url>
<loc>http://example.com/en</loc>
<link rel="alternate" href="http://example.com/fr" hreflang="fr" />
<link rel="alternate" href="http://example.com/de" hreflang="de" />
<link rel="alternate" href="http://example.com/es" hreflang="es" />
<link rel="alternate" href="http://example.com/en" hreflang="x-default" />
<link rel="canonical" href="http://example.com/en" />
</url>

<url>
<loc>http://example.com/fr</loc>
<link rel="alternate" href="http://example.com/fr" hreflang="fr" />
<link rel="alternate" href="http://example.com/de" hreflang="de" />
<link rel="alternate" href="http://example.com/es" hreflang="es" />
<link rel="alternate" href="http://example.com/en" hreflang="x-default" />
<link rel="canonical" href="http://example.com/fr" />
</url>

Thank you!



Answers 1


The canonical and alternate tags IMHO should be used in the HTML of a page.

The sitemap should only contain the URLs that you want indexed.

So the sitemap should look like this:

<url>
<loc>http://example.com/en</loc>
</url>

All other URLs should not be included in the sitemap.

CP3O
CP3O
March 04, 2016 08:30 AM

Related Questions


Updated March 03, 2019 08:04 AM

Updated February 22, 2017 17:04 PM

Updated June 10, 2015 12:01 PM

Updated April 09, 2015 19:01 PM

Updated May 27, 2015 21:01 PM