What is a Canonical URL? And Why Should You Care?

What do you do for your blog to reach more readers? Most bloggers share their articles on different platforms.

This is a great way to promote your blog and content. But there is a right way of doing it. If you don't do it right, you will end up doing more harm than good to your blog.

In this article, you will learn about canonical URLs. By the end of the article, you will know what they are, why they are important, and how to use them.

What is a canonical URL?

A canonical URL shows search engines the primary source among webpages with duplicate content.

Assuming you post an article on your blog. And you also share the same article on platforms like hashnode and dev.to. The same content is now available on three different pages on the internet.

The canonical URL lets you decide which one should be treated as the original.

Why you should use it.

But why should you care about showing which one is the "original" version? To enable search engines like Google to properly index your articles. And know which one to direct traffic to.

If you do not set canonical URLs for duplicate content, you leave it to Google to choose which one to rank (display in search results). And that might not be your preferred option. Or worse, google might treat all as spam and not rank any. Either way, you will hurt your SEO.

A canonical URL lets you decide which one search engines should display among search results.

Use a canonical URL anytime you share your articles across platforms.

How to use a canonical URL

Add a rel attribute to the HTML <link /> tag. The value of the rel attribute should be canonical. See the example below.

<link rel="canonical" href="https://yourblog.com/your-article" />

This should be inside the HTML head (<head></head>) tag.

The good news is that for many blogging platforms, you don't need to worry about doing this manually.

They provide space for you to copy and paste the link. And behind the scenes, it will set the canonical URL automatically for you.

How to add a canonical URL in hashnode

Go to the draft settings. You will see the option in the screenshot below. Copy and paste the URL of your primary source in the provided space.

Hashnode settings for adding canonical url

How to add a canonical URL in Dev.to

First, click on the settings icon on the draft page. See the screenshot below.

Dev.to page for draft blogs

A pop-up appears on the screen when you click the icon. Copy and paste the URL for your primary source in the space provided.

Dev.to settings for adding canonical url

Conclusion

Sharing your content on different platforms is great. It helps you reach more people. But you only get better results if do it the right way of doing it.

Setting a canonical URL is a best practice when sharing your articles on more than one platform.

Now, you know what a canonical URL is, why you should use it, and how to use it. Keep creating and sharing valuable content. Happy blogging!

Let's Connect!

Thanks for reading this article.

Check out my YouTube channel.

I would love to hear from you. Say hi via LinkedIn or Twitter.