SEO and canonical links

SEO and canonical links

In the process of moving to hexo and off of Medium I ended up doing a bit of research into SEO and canonical links. Luckily this research came just in time for assisting a fellow blogger who had similar questions, albeit for a different reason; his content was being copied without correct canonical attribution! :O

A Canonical link is used when similar content exists in “more than one place” - be it in the same website, or somewhere across the internet. The canonical link is used in order to tell search engines that “this content is duplicated from somewhere, and this somewhere is the original source”. It’s important to use canonical links for content that exists in multiple places, as it benefits your Search Engine Optimization (SEO) in that you aren’t punished for, or competing with, your own content hosted in multiple places. SEO is important as it helps drive traffic to your site.

It was stated above that you can use canonical links as to not compete with your own content hosted in multiple places - and that’s the biggest reason I’m doing it. When not using canonical links, your search engine relevance can take a hit as there is “duplicate content” out there, potentially hurting all occurences of said duplicate content from a search engine perspective. With a canonical link, it is known that it’s not duplicate content, it’s just hosted in multiple places, and the search engine is smart enough to understand this fact, and not punish you for it.

I’ve gone through various blogging platforms through the years:

In all of the above cases, I would generally write a post in one place, then within a few days or weeks cross post it to another platform, making sure to utilize a canonical URL to point back to the platform in which I originally posted the content. Going this route allows me to keep my primary blog platform (at the time) as the “original source of truth”, but also allows me to get additional exposure by cross posting to other places (medium, dev.to), all of which have their own internal content distribution networks.

Now that I’m moving over to Hexo, I am in the process of cross posting some of my posts from other platforms, to this one. This is probably the longest streak I’ve had with blogging, so I have a lot more posts to work with than previously, so I’m probably not going to do all of them, as I have in the past; but the ones I do do, I will be making sure to use a canonical URL!

Canonical links are luckily quite easy to employ! You simply place <link rel="canonical" href="https://myOriginalContentUrl" /> within the head of your page, that’s it!

What about on Hexo/Icarus?

One of the first things I needed to look into when moving over to Hexo, was how to specify the canonical URL, as I generally do some “back porting” of posts from my other platforms, to my new, just to have some content in there. I did not see a built in way to do this with Hexo/Icarus, though I’m sure there are plugins. Either way, I ended up submitting a PR to the Icarus plugin code repo, and got a very rudimentary implementation on canonical URL specifying put into the Icarus code base! :D

The Icarus specific canonical URL can be used by placing canonical_url: https://myUrl.com/ within your posts front matter, looking similar to this:

How to specify a canonical URL with Icarus

And what it looks like from view source:

HTML source

Related:

Author

Russ Hammett

Posted on

2019-03-24

Updated on

2022-10-13

Licensed under

Comments