The problem ð§
Duplication within your own domain
Let's assume you have a page on your website that has the identical content as another page, for example:
https://yourwebsite.com/blog/seo-optimization
https://yourwebsite.com/en/blog/seo-optimization
https://yourwebsite.com/blog/page.php?id=4711
This would be bad, because the search engines would not know which one is the "real" link, which one should be indexed in their engine. This results in that page being "punished" by ranking it down.
Cross-domain duplication
The same happens if you say, have a blog where you passionately share your content, and post the same content on another blog to enhance the reach of your knowledge:
https://yourwebsite.com/blog/your-blogpost
https://dev.to/yourusername/your-blogpost-2e79
This would cause your website being ranked down, because there is another site with the same content as yours.
This is where canonical links come in.
The solution ðĄ
A canonical URL is the "preferred" or even "original" page of your content. To include it in your website, you set a <link>
-tag with rel=canonical
in the <head>
-part of your HTML as such:
<link rel="canonical" href="https://yourwebsite.com/original-post/" />
This way we tell the search engines that https://yourwebsite.com/original-post/
is the original content origin.
It works similar to a HTTP 301 header (moved permanently), just that the website is not actually being redirected.
Self-referencing
You might ask yourself if it's necessary to set a canonical link to your page, even if you only have the content on a single page and are not referencing any third-party content.
Yes, it is highly recommended to have canonical URLs in every page of your website. The reason for this is, that if you share social media campaigns with links such as https://yourwebsite.com/your-post?social_campaign=twitter
or https://yourwebsite.com/your-post?social_campaign=facebook
, it is a different URL with the same content. As we learned, this gets your page ranked down by search engines.
Common mistakes
The 5 most common mistakes when dealing with canonical links, according to Google are the following:
- Setting canonical URLs for paginated sites
- Using relative URLs instead of absolute ones
- Multiple declarations of rel=canonical
- Category or landing page specifies rel=canonical to a featured article
- rel=canonical in the
<body>
element
Read more about these mistakes on Google's Webmaster Central blog.
Photo by kaleb tapp on Unsplash