The Ultimate Guide to Canonical Tags – Everything You Need to Know

Are you looking to avoid duplicate content? If yes, then canonical tags are what you have to learn all about. They were created by Google, Microsoft, and Yahoo and have been around forever (okay, since 2008). Their main job is to help website owners solve issues with duplicate content in an easy and efficient manner.

If you’ve started tipping your toes in content marketing or you’re simply the owner of a blog or website, then you certainly need to know all about canonical tags. In this article, we will go through everything from explaining what they are and how they work to giving you best practices to implement them.

So without further ado, let’s get started.

What is a Canonical Tag?

The definition of a canonical tag is that it’s a snippet of HTML code that helps differentiate the main version from duplicate, near-duplicate, and similar pages. Or, to put it in other words, if two or three pieces of the same content can be found under different URLs, you can utilize canonical tags to show which version is the original and should be the one that gets indexed.

Canonical tags tend to use simple syntax and are most often placed in the section of a website. The line of code usually looks like this:

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

Each part of this line of code has the following meaning:

  • link rel=” canonical”: This points out that the link in this tag is the original (canonical) version of the page.
  • href= “https://mypage.com/sample-page/”: points out that the canonical version can be found at that URL.

Why Do Canonical Tags Matter for SEO?

Search engines don’t like duplicate content because it makes their job a lot harder. They have to choose between

  • which version of the page to index
  • which one to rank for relevant searches
  • whether to give all “link equity” on one page or split it between all the different versions

Furthermore, if you have a lot of duplicate content, you’re also risking it having an effect on your “crawl budget.” This means that instead of spending time searching for new valuable content, Google just keeps on indexing the same content on different URLs. Canonical tags can solve that problem for you. They allow you to tell any search engine which version of a page has to get indexed and ranked and where the “link equity” has to go.

However, if you don’t specify a canonical URL, Google will do it for you instead. You want to avoid that if possible, as the search engine can choose the version of the page that you don’t want to be canonical.

How Do You Check If You Have Duplicate Content?

Most people assume that they don’t have any duplicate content on their website, as they’re not posting the same things multiple times over. However, search engines do not crawl pages; they crawl URLs.

This means that they see mypage.com/my-product and mypage.com/my-product?color=blue as completely different pages, even when they contain the exact same or similar pieces of content. These are referred to as parameterized URLs and commonly cause duplicate content, especially on websites that sell products online and have faceted or filtered navigation.

Let’s take a look at an example. Brown Bag Clothing sells shirts, and this is the URL for their main page:

However, if you want to filter by something, like the size, for example, a parameter is added to the URL:

If you add in another filter, you get an additional parameter as well:

All of these pages are different from search engines, even though their content is 90% the same. However, this is just one example, and there are plenty more related to other industries besides eCommerce:

  • have parameterized URLs for search parameters and session IDs (mypage.com?q=search-item and mypage.com?sessionID=5)
  • have a specific print version for a page (mypage.com/page and mypage.com/print/page)
  • show the same content with and without a capital letter in the URL
  • show the same page with https and non-https variants
  • show the same page with www and non-www variants
  • have AMP and non-AMP versions of a web page

In all of these situations and many others, having a canonical tag is of vital importance. Along with that, cross-domain duplicate issues also exist. Especially if you’re syndicating content, it’s really important to use canonical tags on every article to specify the syndicated content as canonical.

Now, this doesn’t prevent syndicated content from ever showing up in search results, but it does lessen the chances of that happening.

How to Implement Canonicals

Now that you know what canonical tags are, you might be wondering how you can utilize them. Well, there are five ways to implement canonical URLs, and all of them are referred to as canonicalization signals. Here they are:

  • HTML tag
  • Sitemap
  • 301 redirect*
  • Internal links
  • HTTP header

1.Use rel=”canonical” HTML Tags

The simplest, most obvious way to specify a canonical URL is by using the rel=” canonical” in it. To do that, you have to add the below code to the part of the duplicate page:

There are plenty of ways to do that. One of them is by alternating the code of your page and just adding the following canonical tag to any duplicate pages:

However, if you’re using a CMS system, you wouldn’t need to make any changes to the coding. There are easier ways to implement canonical tags.

How to Set Canonical Tags in WordPress

If you install Yoast SEO, then self-referencing canonical tags get added automatically. If you want to use custom ones, you can do so in the “Advanced” section on each page or post.

How to Set Canonical Tags in Shopify

If you’re using Shopify for your online store, then you have to know that it adds self-referencing canonical URLs by default. If you need to make custom ones, you can do so by editing the template (.liquid) directly.

How to Set Canonical Tags in Squarespace

Squarespace is another platform that adds self-referencing URLs automatically. Like with Shopify, if you need to add a custom canonical tag, you will have to edit the code directly.

2.Set Canonicals in HTTP Headers

There are documents (like PDF files) that don’t allow you to place canonical tags on the page because there’s no header section. You’ll have to set canonicals in the HTTP headers in these cases.

Let’s say you have a PDF version of a blog post, and you decide to host it in the blog subfolder. Then, the HTTP header for that file will look like this:

  • <htttps://mypage.com/blog/canonical-tag/>; rel=”canonical”

3.Set Canonical Tags in Sitemaps

As per Google, sitemaps shouldn’t have non-canonical pages included, which means that only canonical URLs have to be listed. That’s because search engines look at the pages listed in a sitemap as canonicals. That being said, they won’t always choose URLs in sitemaps as canonicals.

It’s not guaranteed that sitemap URLs will be considered canonical. However, it’s an easy way to define canonicals for a more significant site. Furthermore, sitemaps are a simple way to tell search engines which pages are the most important ones on your website.

4.Set Canonical Tags with 301 Redirects

You can use 301 redirects whenever you want to move traffic away from a duplicate URL and point it to the canonical version. Let’s see an example.

Let’s say your site is reachable at these URLs:

  • mypage.com
  • mypage.com/index.php
  • mypage.com/home/

You have to choose one of these URLs and make it a canonical one. Then all other URLs have to get redirected to it. The same has to be done for the http/https versions of your website, as well as the www/non-www variants. Pick one as canonical and then redirect all of the others to it.

For example, the canonical version of mypage.com is the https non-www URL (https://mypage.com). That’s why all of the other URLs have to be redirected there:

5.Use Internal Links

The way you link from one page to another across the entire website is an SEO canonicalization signal. One way to do it properly is by picking a URL format and using it consistently throughout the whole website.

This makes the search engine’s job more accessible because it lets it know which URL you prefer to be canonical. There are several criteria that Google uses in order to pick the canonical URL. Here they are:

  • Site’s preference (which one does it look like the site wants to use?)
  • User’s preference (which one would be the most useful for the user?)

When it comes to the site’s preference, Google looks at the link rel canonical annotation and redirects, internal linking, and which URL is in the sitemap file. That’s why it’s critical that you’re consistent with the format of the URLs that you want to be chosen as the canonical ones.

The Vital Rules for Implementing Canonical Tags

As you might have already figured out, canonicalization is easy to do. Currently, there are five different ways to do it. However, no matter which method you choose to opt for, there are a few essential rules that you must remember at all times.

Use Absolute and Lowercase URLs

Avoid using relative paths with the rel=” canonical” link element. By using absolute URLs, you will be sure that the link will be interpreted correctly. That means that instead of using the following structure:

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

You have to opt for this one:

Along with that, Google treats URLs with lower cases and uppercases as two different URLs. That’s why you want to make sure that you use lowercase URLs on your server and lowercase ones on your canonical tags.

Use the Right Domain Version (https or http)

If you’re using an SSL, be certain that you don’t use any non-SSL (http) URLs in your canonical tags. If you accidentally do that, it can lead to unwanted results. However, if you’re using a secure domain, you have to ensure that you’re always using these structures for your URL:

Utilize Self-referential Canonical Tags

Using self-referential canonical tags is not mandatory. However, it is recommended by some of Google’s experts. That’s because by doing so, you make it obvious to the search engine which page or URL has to be indexed.

If you don’t know what a self-referential canonical tag is, it’s basically a tag on a page that points to itself. Let’s look at one example here. If you have the URL https://mypage.com/sample-page, then a self-referencing tag would look like this:

Today, most CMS automatically adds self-referencing URLs; however, a developer may need to code this separately if you’re using a custom CMS.

Additionally, if a page has more than one canonical tag, Google will ignore both of them, so try to avoid using all multiple canonical tags.

Final Thoughts

Canonical tags can sound really complicated, especially if you have no previous experience with them. However, once you begin using them, you will see how easy their implementation is. It doesn’t take a lot of time, and it definitely brings in results.

One key thing you have to remember is that canonical tags are just a signal for search engines. They’re not directive. This means that Google may choose a different canonical one from the one you’ve pointed out.

That being said, they’re still incredibly useful when you do content marketing and want to optimize your traffic. If you still haven’t used them on your website, regardless of whether it’s a blog or online store, then you definitely should start to. More often than not, you will likely see a spike in traffic from the beginning, and along with that, you will optimize your website so that it offers a better user experience as well.

Hopefully, the explanations and tips given in this article have helped you get a better understanding of what canonical tags are, why they are important, and how you can implement them.

Posted in ,
Tags: ,

Leave a Comment

Share to...