REQUEST DEMO OnPage Champ is launched on Product Hunt. Don't forget to support us there.

Canonical URLs: A detailed guide to Canonical Tags

Canonical URLs: A detailed guide to Canonical Tags

There are a lot of cases when you will have similar content displayed on multiple web pages. 

For instance, it’s quite common for an ecommerce store to adjust their URLs based on product specifications. 

You can have the same dress in three different colors and sizes. Their URLs may slightly differ, but the content remains the same. 

In such events, you risk the content duplication issues. 

Google frowns upon duplicate content because it doesn’t let it decide which page to show on the top of SERPs. As a result, it punishes pages with duplicate content, resulting in a negative impact on your SEO. 

You can avoid duplicate content issues by using canonical URLs. It plays a vital role in how search engines index and evaluate the quality of your pages.

Let’s understand what canonical URL is, why it is important, and how you can use it.

What is a canonical URL?

A canonical URL is referred to as “rel=canonical” tag in the HTML. When there are multiple sources for similar content, a canonical tag informs search engines which URL to index over other identical pages. 

This URL that houses the original source of content is known as the canonical URL.

The canonical tag can be found in the HTML head of a webpage.

What does a canonical tag look like?

A canonical tag is a simple syntax that appears within the <head> section.

Here, how it looks like:

Canonical tag in HTML

The link used here is the original version of this page. It means that the page referring to a canonical version is the duplicate of the specified URL.

Why are canonical tags important for SEO?

Duplicate content can create a problem when search engine crawlers try to index a page. 

Even if your intention wasn’t to manipulate search engine rankings, the problem is that search engines crawlers don’t know that.

What I mean to say is that if you don’t use the canonical tag, Google will assume that onpagechamp.com/blog and https://onpagechamp.com/blog/ are two different pages with similar content. 

But you and I both know that it isn’t the case. These are URL parameters, which can be mistaken as a duplicate content. 

Search engines penalize a site that shows duplicate content without using canonical tags. 

If you have similar web pages, canonical URL tells search engines which is the valued destination. 

That way, it passes SEO value to the canonical page without even penalizing the page that copies content. 

Thus, if you want to protect your ranking, the proper use of canonical tags is essential. 

Canonicalization is the process of indicating your preferred URL to Google.

When to use a canonical tag?

There are several reasons when you should use a canonical tag:

1. When you have to self-reference a page

Even if you have only one version of a page, it is recommended to set it as its own canonical URL. This is known as ‘self-referential canonical URL.’

In fact, Google webmaster John Mueller confirmed that self-referencing canonical URLs could help your page perform well in search results.

“I recommend doing this self-referential canonical because it really makes it clear to us which page you want to have indexed, or what the URL should be when it is indexed. 

Even if you have one page, sometimes, there are different variations of the URL that can pull that page up. For example, with parameters in the end, perhaps with upper lower case or www and non-www. All of these things can be cleaned up with a rel canonical tag.”

Most CMS platforms do this automatically but it’s safe to keep a tab always. This ensures the entire link juice goes to one URL, irrespective of its programmatic variations.

2. When you syndicate your content

You must have noticed how people republish an exact copy of their content on third-party websites, such as LinkedIn and Medium. 

This is known as content syndication.

If you too syndicate your content on other websites, it’s preferred to specify the original article as the canonical version with a cross-domain canonical tag.

Google might still choose to show the syndicated content on the search result, but it can help identify the original link and lessen the risk of it outranking the original.

Tip: You can have the sites that use your syndicated content to insert the noindex meta tag. It will prevent search engines from indexing their version of the material.

3. When you run an A/B test on your web pages

A/B testing is running a test by creating multiple versions of a page to see how users’ interact with each page. 

Each page has its own variations, and it can have slight variations in colors of various buttons or significant changes like the page content. 

In such instances, Google might crawl up all pages and get confused. You can use the rel=“canonical” link attribute on all of your alternate URLs to indicate the original URL. 

This canonical URL will help search engines identify your preferred version.

4. When you have different variations of the same page

When pages are slightly different, it is called duplicates (or near duplicates). 

This is quite common in ecommerce websites. Let’s say, you deal in Gucci belts and have a red belt available in two different sizes – 34 and 36.

Upon selecting the different sizes, the URL changes. But the content almost remains the same. 

Here how the URLs will look like: 

Gucci Red Belt: example.com/belts/gucci/red/

Gucci Red Belt size 34: example.com/belts/gucci/red-34/

Gucci Red Belt size 36: example.com/belts/gucci/red-36/

The content is very similar in all three URLs. It’s advisable to set a canonical URL (pointing to example.com/belts/gucci/red/) for the other two URLs with the same content.

Canonical URLs are a common SEO practice for ecommerce sites to help search engines index the top pages.

5. When two content pieces are unique but have the same search intent

Let me help you understand this with an example. 

Say you have a blog post that talks about the title tag — SEO Best Practices in 2015.

You have another article on the same topic that talks about SEO best practices in 2020. 

Even though the content might be unique, you would want your users to read the updated version. 

In such a scenario, you can use a canonical tag on an old blog post and direct it to the new blog post.

This will help Google do a much better job in ranking a single piece of the article.

6. When you have separate desktop and mobile pages

When you create separate pages for mobile and desktop with the same content, don’t forget to use the canonical URLs and the alternate URLs. 

It helps communicate the relationship between these pages to search engines.

On the mobile version of the page, you can use the desktop version as the canonical URL in the <head>-section. 

And to be on the safer side, you can use an alternate URL and the canonical URL on the desktop version of the page. 

It might look like this: 

<head>

 <link rel=”canonical” href=”www.sample.com/” />

 <link rel=”alternate” href=”m.sample.com/” />

</head>

An alternate URL helps Googlebot find the location of your website’s mobile pages.

7. When you are consolidating unnecessary pages with redirects

When you have multiple URLs for a page, the best practice is to use 301 redirects. It helps send traffic from the other URLs to your preferred URL. 

A page might be available through the HTTP and HTTPS protocols. 

In some cases, your home pages can be found through multiple domains — www.sample.com and www.sample1.com. 

301 redirects help establish authority over a page. 

But even if you use redirect, it is recommended to still use the canonical URL. 

In case your redirects don’t work, you will still have your canonical URL to prevent indexing and duplication issues.

Canonical Tag Best Practices

While implementing the canonical URLs, there are certain tips that can come in handy.

1. Use absolute URLs

You should leave no room for confusion as to which page search engine crawlers should index. 

It is advisable to use the full URL, including protocol, domain, and subdomain. 

In fact, John Mueller from Google has to say the same:

It should look like this: 

<link rel=“canonical” href=“https://sample.com/random-page/” />

And not like this:

<link rel=“canonical” href=“/random-page/” />

2. One canonical tag per page

If you have multiple declarations of canonical tag per page, Google will choose one of the canonical URLs and ignore the others.

That’s why it’s preferable to have only one canonical URL per page.

3. Use lowercase URLs

Google considers URLs as case-sensitive. So to avoid any confusion, you should stick to only one version.

However, the lowercase URL is recommended because people generally tend to link to this more traditional version.

4. Use correct domain version (HTTP vs HTTPS)

If you use SSL (HTTPS) in your URLs, make sure that you use only SSL URLs in your canonical tags. 

If you mix https and http, it leads to confusion.

5. Use self-referential canonical tags

As previously mentioned, even if you don’t have multiple versions of a page, it is recommended to set up self-referential canonical tags for the same.

6. Include only preferred version in the XML sitemap

All the pages that you include in your XML sitemap are considered as canonicals. 

Based on the similarity of content, Google decides if any pages are duplicate or not. 

Therefore, in case you have multiple URLs for a page, you should only specify the preferred URL of that page.

How to set up canonical URLs?

There are a few different ways in which you can set canonical URLs.

1. Setting canonicals via HTML tag

The most common approach to specify the canonical version of a page is by using the rel=” canonical” <link> tag. 

You simply add the appropriate URL to be used as the canonical address to the <head> section of any duplicate page. 

<link rel=“canonical” href=“https://sample.com/canonical-URL/” />

2. Setting canonical via Yoast plugin

In Yoast SEO WordPress Plugin, you can change the canonical URL of several pages in the plugin settings.


Please note that you only need to do this if you want to change the canonical to something different from the current page URL. 

Otherwise, the Yoast SEO plugin sets up self-referencing canonical tags automatically.

3. Setting canonicals with 301 redirects

This method is used to direct traffic away from a duplicate URL and to the canonical version. Using a canonical tag ensures a smooth transition. 

For example, you have four URLs directing to your homepage:

sample.com

www.sample.com

sample.com/index.php

sample.com/home/

Choose one URL as the canonical and redirect the other URLs there.

Common canonicalization mistakes to avoid

There are certain common misconceptions about canonicalization that you can avoid.

Mistake #1: Using robots.txt to block canonicalized URL

A robots.txt file is used to tell search engine crawlers which page they can or can’t request from a particular site. 

When you use robots.txt to block a URL, Google crawlers can’t see any canonical tags on that page either. 

Thus, it doesn’t help in transferring any link equity from the non-canonical to the canonical URL.

Mistake #2: Having multiple rel-canonical tags

Another major problem is when pages include multiple rel=canonical links to different URLs. 

This generally happens when SEO plugins insert a default rel=canonical link. 

Earlier, Google declared that in cases of multiple declarations of the canonical tag, they would ignore all the rel=canonical hints.

However, in a recent tweet by John Mueller from Google webmaster, he stated otherwise.

Mistake #3: Rel-canonical in the body

For the rel=canonical link tag to be effective, it needs to appear in the <head> of an HTML document. 

When Google crawlers find a rel=canonical designation in the <body>, it gets ignored. 

Besides, if you want to avoid HTML parsing issues, it is recommended to use the rel=canonical as early as possible in the <head>.

Mistake #4: Canonicalizing all paginated pages to the root page

Don’t canonicalize the paginates pages to the first paginated page in the series. 

The reason is pretty simple. Page 2 isn’t similar to page 1, and so the use of rel=canonical would be incorrect.

Instead, you should use self-referencing canonicals on all paginated pages.

Deleting non-canonical versions.

Conclusion

It must be clear by now that choosing a proper canonical URL for every set of similar URLs can improve the ranking of your site. 

Canonical URL helps search engines understand the structure of your content in a way that can result in improved users’ search experience. 

1 thought on “Canonical URLs: A detailed guide to Canonical Tags”

Leave a Comment