Rel=”alternate” and rel=”canonical” are the most used and probably the most confused REL Attributes.What are REL Attributes?
A rel attribute specifies the relationship between the current document and the linked document and can only be used if the href attribute is present. In addition, they are of no use to a web browser and only relevant for the search engines.
What is rel=”canonical” tag?
rel=”canonical” tag is a way to let Google know that the content of a URL is duplicate or near duplicate of another. For example, If URL x is a duplicate of URL y, then the tag will point to URL y and will appear in the HTML code(between <head> tag) of URL x:
<link href=””http://www.mysite.com/urly.html”” rel=””canonical”” />
Most search engines including Bing, Google and Yahoo support rel=”canonical”. The canonical tag is used widely for most of the duplicate content including redirecting a desktop site in case of a mobile device.
What is rel=”alternate” tag?
rel=”alternate” tag is again useful for duplicate content, however, in a little different scenario:
- template (i.e. side navigation, footer) is machine-translated into various languages, main content remains unchanged, creating largely duplicate pages.
- main content remains unchanged, creating largely duplicate pages,
Suppose, the website mysite.com has international reach and multilingual users. A user Fabio Guevara, a German speaker, makes a profile on the website and is allocated a dedicated page ge.mysite.com/Fabio.g. The page, being a part of a multilingual website, will soon become available in other languages too, in addition to German.
Every version of the page will display a different URL.
Thus, we require to use rel=”alternate” tag, pointing to the original page for every language variant.
In addition to language purposes, this tag can also be used on RSS, PDF, or any other media using the page content.
For the above example, suppose the English version of the page is en.mysite.com/Fabio.g. Then the code will point to the German version and will be appear in the HTML <head> tag of the English page.
<link rel=”alternate” hreflang=”en” href=”http://ge.mysite.com/Fabio.g” />
Similarly, for the PDF version of the original page, following code can be applied.
Link: < http://ge.mysite.com/Fabio.g />; rel=”alternate”; hreflang=”en”>
What is the confusion?
Actually there are no confusions. The canonical tag and the alternate tag are supposed to be combed together as per Google Webmaster Blog:
“When rel=”alternate” hreflang=”x” is included in conjunction with rel=”canonical” or 301s, not only will our indexing and linking properties be more accurate, but we can better serve users the URL of their preferred language.”
If a user is surfing the page from the UK, the English version of the page should pop on his browser. How can he be redirected to the English version without the rel=”canonical” tag? Thus, without rel=canonical, rel=“alternate” is irrelevant.
As the German version of the page (ge.mysite.com/Fabio.g) is default profile for Mr. Fabio Guevara, the English variant has to put <link rel=”canonical” href=”http://ge.example.com/ Fabio.g” />
So does the every other language variant.