What is canonical link element? & How to use it?
canonical link element
The rel=canonical element, often called the “canonical link”, is an HTML element that helps webmasters prevent duplicate content issues.It does this by specifying the “canonical URL”, the “preferred” version of a web page – the original source, even. Using it well improves a site’s SEO.
Benefit of rel = canonical in SEO
Choosing a proper canonical URL for every set of similar URLs improves the SEO of your site. This is because the search engine knows which version is canonical, so it can count all the links pointing at all the different versions as links to the canonical version.
How to use it?
Let assume that we have two versions of same page with same content. There is some difference in both versions page in menu or background color. But content is same. So which version should search engine show?
For Example: http://site.com/canonical-link.html
- Pick one page as canonical version which is more important.
- Add rel=canonical link from non-canonical to canonical page. So if we picked short URL as canonical URL, then the other URL would link to the shortest URL in the head section of the page-like below:
<link rel="canonical" href="https://site.com/canonical-link.html"/>
That is how two pages merge into one from search engine's perspective.