What are Canonical URLs & How to Create One (2020)

URL Canonicalization

    URL Canonicalization

    What is a canonical URL?

    A canonical tag (aka rel= "canonical") is a simple HTML code that tells the search engines which version of the URL they should pick for indexing and therefore showing it in the search results and this target URL is called canonical URL. In other words, you will set up this canonical URL to tell the search engine crawlers that this particular URL represents the original copy of a page.

    Canonical URL sample
    Now let me show you an example of this canonical tag.

    canonical code example

    Why is URL canonicalization used in SEO?

    So what is canonical tag in SEO? Started in February 2009 by Google & other search engines, the canonical link element or rel=canonical tag is used to avoid duplicate content, which may result in a penalty.

    Now you might be thinking, what are these duplicate contents and why I would even create one?. 


    The thing is you don't always create one intentionally. Let me show you simply how it works. But first, let's show you what the problems are that forcing everyone to use the canonical tag in their pages or posts.

    Problems solved by URL cannibalization 

    Problem type - 1
    For example, let's assume you have a website whose URL(Home-page) is this www.example.com.

    Now when the search crawlers enter your site to crawl, they can enter your site through different URLs like

    • http://www.example.com
    • https://www.example.com
    • http://example.com
    • http://example.com/index.php
    • http://example.com/index.php?r

    Now you know that all these URLs are the same in terms of content, and when crawlers enter through each URL, they will find the same content every time. Now, what seems to be wrong with this?

    The problem is these URLs may be the same in your eyes, but for search crawlers, all these 5 URLs are different and unique. If the crawlers find all these five different URLs leads to the same content, then it will be bad for your SEO and Google will penalize you based on the Google Panda algorithm.

    Now to solve the issue, we use canonical tags. It tells the search crawlers to index only one version of the URL, which we mentioned as the original copy earlier.

    Problem type - 2

    let's consider in an eCommerce website a particular product page URL is

    http://example.com/products.html (Original copy)

    Now we know that for the Print version, PDF version, and AMP version, the similar product page URL will be different. As follows

    Print version - http://example.com/products_print.html

    PDF version - http://example.com/products.pdf

    AMP version - http://mobile.example.com/products.html


    Now Google crawler will consider these URLs as different, so you need to apply the canonical tag, which will consist of the original copy of the URL in the Print version, PDF version, as well as in the AMP version individually. Here's the canonical tag will look like this 

    <link rel="canonical" href="http://example.com/products.html"/>

    canonical tag for different version of URL
    Link advantage passes through different URLs

    Not only will it help the search crawlers to decide which page to index, but it will also provide a linked advantage to the actual URL of the product page that has been received from the other three different versions of the product page.

    Apply Canonical Tag for similar content or pages

    Let's consider you have a website, and in 2015 you published an article about "top 10 action movies of all time," and in 2020, you published a similar article but with very little difference in content.

    Now let us consider that the article you published in 2015 has a lot of backlinks and share or engagement; therefore, the good amount of link juice. Now you want that link advantage in your newly published content.

    To do this, you can put the URL of the latest content in the previous post as Canonical URL. What it will do is, it will tell the search crawlers that both of the material are the same, but I want to index the latest published content.

    Thus you will not only prevent duplicate pages, but you will also get some link juice from the previously published material.

    Whats makes it worse
    The content management system (CMS) increases these duplicate content problems even worse, especially for E-commerce websites. The E-commerce websites are dynamic and code-driven, and they automatically add tags and create multiple URLs for the same content by adding URL parameters for searches, sorts, and different currencies, etc.

    Why are canonical URLs essential for SEO?

    If you have more than one URL for a single piece of content, you will make it harder for such crawlers to choose
    • Which version of the URL you want to index
    • Whether they should provide "link juice" to one page, or split it between multiple versions of that URL.

    What if you don't canonicalize your duplicate contents?
    If you have the right amount of duplicate pages or contents in your website, it can
    • Affect your "crawl budget." (It will end up crawling similar pages multiple times due to multiple URLs thereby it will avoid other essential contents in your website)
    • In search engines, it may index a URL that is not your preferred URL.
    • Manipulate your Analytics data like Google Analytics will only choose one URL for a single webpage so if your webpage has different URLs it will only pick one URL and will avoid the data received from other URLs.

    How to create canonical URLs easily

    Process - 1
    Using rel="canonical" HTML tags

    Now, as you have learned, what canonical tag or canonical link element is, so let's see how you can make one for your website.

    Let's assume you have two different versions of the same web page, and the content in them is entirely the same. Still, the only difference is that they are placed in two different parts of the website, and both of them have links from other websites, so clearly, the content is valuable. So how can you decide now which version you want to show in the search results?

    Let's say the two URLs are
    • https://example.com/hollywood-action-movies/
    • https://example.com/movies/hollywood/action-movies/

    Now you choose one between these two options. Confuse about choosing the right URL for you? see the step - 1 below

    Step - 1
    Choose the one that is the latest in terms of information. If you are still confused, then you simply choose the URL that looks clearer or has a higher number of likes and shares. Whichever one you like but choose any one of them.

    Step - 2
    Let's assume you have chosen the second URL(https://example.com/movies/hollywood/action-movies/) as your canonical URL or preferred URL, and you want to show this URL in the search result. Now the canonical URL will look like this.

    <link rel="canonical" href="https://example.com/movies/hollywood/action-movies/"/>

    Step - 3

    Now all you have to do is take the code and paste it just after the <head> section of the duplicate webpage, for example, the duplicate page here is

    https://example.com/hollywood-action-movies/

    Step - 4

    What? Your work is already done. Step - 3 was the last step.

    Process - 2
    Canonical Tag Using Yoast SEO in WordPress

    This is probably the easiest way you can create canonical URLs. All you have to do is install the Yoast SEO plugin. What it will do is, it will automatically add self-referencing canonical tags to every page and post.

    Here self-referencing canonical tag is nothing, but the tag consists of the original copy of the URL that you want search results to show out of those different URLs that are created due to the modern Content Management System (CMS).

    But if you want to create the tag manually, all you have to is go to the duplicate content page in WordPress and click "Edit," and at the bottom, in the "Advanced" section, you will get an option to put your preferred canonical URL. Just paste the URL of the original copy of the content and all done.


    setting canonical url in Yoast SEO plugin
    Yoast SEO Plugin


    Make sure you put only the URL of the original copy, not a whole tag like this.

    <link rel="canonical" href="https://example.com/movies/hollywood/action-movies/"/>

    When to use canonical URLs, and what are best practices?

    A canonical tag is a potent tool if used correctly and carefully. So it is crucial to know when and what way you can use it to get the best result.

    1. Self-referential canonical tags
    Google recommends that it is best to use a canonical link element on every page, even though there may not be a possibility for a page to have duplicate content.

    What you need to know is that if you have three URLs as X, Y, and Z 

    and all these URLs have the same duplicate content, and X is the canonical version, then it is entirely ok and acceptable to put the canonical tag on the X URL page. Although, it is pointing towards the same URL, which is also X. 

    So X pointing towards X. Sounds easy, but believe me, some people get confused.

    2. 301 redirect or canonical tag What to use?
    Let's consider you have two blog webpages like A and B with different URLs but similar content on them. Then

    1st case

    If the page authority, post engagement is the same for both pages, then it always makes sense to 301 redirects one page to another. As a result, the user and search crawlers will only see the redirected version of the page. The other version of the page will not be seen by anyone.

    2nd case

    Let's assume that the blog with webpage A was published in 2018, and it has a lot of comments, shares, and backlinks in it. Now in 2020, you post a blog with webpage B that is similar to blog A. Now, you might be thinking why not redirect the blog A to blog B.

    But if you redirect A>B, then you lose the page authority or link juice you have received on Blog A. Also, this is not good for the user experience as the user in the new blog B will not be able to see the comments.

    Now to prevent this, you can simply use the canonical version of the webpage B to webpage A. In this way, users will still be able to see both versions of the webpage. 

    Yet, search crawlers will only crawl and index the new blog post that is webpage B. And most importantly, the latest blog post will get some link advantage from the old blog with engagements in it.

    3. Canonical tag for home-page

    The home-page has a higher probability of creating duplicate URLs, so it is an excellent idea to canonicalize your home-page. As you can see in the picture that Moz is using the rel=canonical tag on the home-page.

    Canonical tag for homepage
    Image credit - moz.com

    4. Canonical URL of near-duplicate pages
    We can also apply canonical tags for near-duplicate pages. For example, in an e-commerce website, a similar product page content can only differ by variation in currency, place, or any product attribute. So here setting up a canonical URL makes sense. But if the content of the pages is very different, google may ignore the tag.

    5. URL Canonicalization of cross-domain duplicates
    Assume that you are a blogger and you have your own website. You publish any blog on your own website, and you also post the same article on some other sites for some other domains for work purposes. So this increases the creation of duplicate content. So now, to avoid this, you can simply apply the canonical tag to other domains to your own websites.

    This will

    • Increase your page authority.
    • Will prevent the non-canonical sites from ranking.
    So use it carefully in a way that matches your business purposes.

    Common mistakes to avoid during URL canonicalization

    1. Assigning canonical tag to the subpages
    Don't attach a canonical tag to the subpages of each post. For example, let's consider that a post name "F" has 5000 words in it, and for simplification, you split the 5000 words into 5 different posts like A, B, C, D, E.

    Now do not assign the canonical tag from the 1st page A to 2nd page B and the 2nd page B to 3rd page C and so on. Because these pages (A-E) are not duplicate pages, they are the different unique parts of the 5000-word post "F."

    Now what you can do is assign canonical tag of the complete post "F" to each subpage (A-E) individually.

    2. Creating a rel= "canonical" tag without HTTP

    canonical tag with https

    In the above picture, you can clearly see the 1st URL is without HTTP/HTTPS attribute; therefore, it is not accepted as a canonical link.

    But for the 2nd link, the HTTP/HTTPS is not mentioned, but it is still accepted because the link is represented here as the form of relative HTML, i.e., just cupcake.html for this target URL http://example.com/cupcake.html"/>

    So you either mention only the relative HTML or write the whole URL with HTTP/HTTPS tag.

    3. Using multiple canonical tags for a single post

    one canonical URL for each post

    As you can see in the above picture, two rel=canonical tags are used for a single post. It is the wrong thing to do as Google will accept any one of the two URLs.

    So only one canonical URL for each post.

    4. Assigning canonical tag to a category page
    Consider you are running a food-related website, and you have a category only for Indian food and also for the other cuisines like Italian, Chinese. Now let's consider your site publish a featured post/blog related to new dishes every day.

    Now you cannot use the Canonical tag in any of the category pages to redirect the category page to this featured post or blog.

    Because if you use the canonical tag to redirect the user to the featured post or article, your category pages will never appear on the search result again, which is never recommended.

    5. Putting canonical tag under <body> tag

    canonical tag under head tag

    In the above, you can see the rel"canonical" is placed inside the <body> tag, but it is entirely wrong.

    The canonical tag will always place between <head> tag not under <body> tag.

    The post should have been stopped here as I already have provided you with every bit of information about the canonical URL before, but there is still something left that might help you to increase your knowledge. Let's see.

    How to check canonical URL of any website

    When you use canonical tags in your website pages, it's worth double checking things like, if the page is pointing towards the correct URL or not. Do it for every page you have on your website.

    Always make sure both the pages are crawlable and indexable. Because if you put any of the two pages under no-index or no-follow, then it will be a waste to use the canonical tag.

    Because the search crawlers will not be able to see the pages and thereby they will never know which page to redirect or canonicalize.

    Now let's see how you can check canonical URL of any website pages.
    • See Source code
    In your browser on the right-click of the mouse, you will see an option that says "view page source" click on that, then the source code page will be open, or you can simply type (Ctrl + U).

    canonical tag in source code

    Now search for the canonical tag within <head> section. It should look like this.

    Or you can simply type (Ctrl + F) and then just type rel=canonical in the search bar if the page is using a canonical URL then you will find it.

    • MozBar chrome extension

    canonical tag using MozBar chrome extension
    MozBar chrome extension

    MozBar from Moz is free and one of the most popular tools. All you have to do is install it and create a free account, then after logging in, open the page for which you want to see the canonical tag. In my case, it is Flipkart.com.

    Now Click on the "Page Analysis" and then click "General Attributes." Nou you will get to see the canonical URL that has been used by the page.

    Google's preference for canonical URLs

    Google picks the Canonical URL based on two things
    1. Sights preference
    2. User's preference.
    Now under site preference, which falls under the site owners category, Google always looks for these things.

    1. rel=canonical tag used in the page
    We already have mentioned in the top portion of the post how to set up canonical or rel=canonical URL, and it's the easiest way you can create a canonical tag so far.

    2. Redirects
    Suppose anyone can enter your home page through these URLs:

    • http://www.example.com
    • https://www.example.com
    • http://example.com
    • http://example.com/index.php
    • http://example.com/index.php?r
    Now you have to choose one URL as the canonical URL and have to redirect the other URLs to the canonical URL.

    3. Canonical tag through sitemaps
    According to Google's recommendation in your sitemap, you always list those pages in the sitemap that have Canonical tags in it.

    They never recommend you to list any web pages in your site map that does not have a Canonical tag in it because Google considers the sitemap page URLs as the suggested canonical URLs.

    But to be fair, it's not completely real that google will select the pages listed in the sitemap as the site's preferred canonical URL. So calm down.

    4. Internal linking
    Google Webmaster also considers the internal linking in your website as a canonicalization signal. All they trying to say is that you have to be consistent with the interlinking.

    It means that you always go for the same URL when your interlinking on your own website also use that same URL when you are creating the sitemap.

    Just don't confuse the search crawlers as well as the Webmaster by using a different version of the URL each time.

    5. Https URLs over Http URLs

    Google will always prefer Https over Http URLs.

    Uploaded in September 2019, this video on Google Webmaster Youtube handle gives us a hint of how Google chooses the canonical URL.



    Final thoughts

    To be fair, the canonical tag is a simple yet powerful tool. This can be very handy for larger websites like e-commerce or any dynamic websites. And if used correctly, it can be very fruitful for SEO purposes.

    Any questions? This is the first time I am writing so, please do leave a comment if you have anything to say.

    You can connect with me on social media - Facebook.

    4 Comments

    1. Very informative.. thanks for sharing.

      ReplyDelete
    2. Really... it's your first blog... well arranged and very brief. So quite helpfull. Keep going...

      ReplyDelete
      Replies
      1. Big thank you for these inspirational words. Will keep working towards providing more information. Keep supporting.

        Delete

    Post a Comment