rel=canonical – Canonical URL links
Matt Cutts has just announced a new tag at SMX West Google, Yahoo and Microsoft have just announced a new link element, henceforth to be known as rel=canonical, which we can use to tell the search engines which URL it should have for the current page. This is probably best explained with an example, so here goes.
Suppose you have read my Twitter Analytics post, and you’ve started tagging all the URL’s you spread on Twitter with Google Analytics campaign variables. So at some point, Google enters your site through this URL:
If it did, in “old times”, this would mean you’d have a duplicate content issue: the same content indexed under two different URL’s. An issue SEO’s have been trying to solve on web pages for ages, which sometimes created huge limitations. This is where the new tag comes in. You add this rel=canonical link to the
<head> section of your page:
<link rel="canonical" href="https://yoast.com/twitter/analytics/"/>
And now, Google will suddenly count the links it has seen to that campaign tagged URL, towards the canonical URL, and not index the campaign tagged URL anymore. Simple, yet effective. Cool huh?
Disclaimer: this rel=canonical tag is only a “hint” to the search engine. While they’ll probably use it 99% of the time, they reserve the right to handle things any way they want, in case of errors etc.
Of course this isn’t just useful for campaign tagging. Many a webshop needs the URL to store sort variables, for instance. But a page that’s sorted by price ascending, is often almost the same as a page sorted by price descending.
Now I have to admit I had a bit (like a couple of days) of a headstart on this one, so I can now make it easy for you if you’re running WordPress, as I’ve got a Canonical URL plugin ready for you!
Working with Marek Sotak, we’ve also developed a module for Drupal that does this, by modifying the global redirect module. Grab it here. Note: this is not an official release of this module, we’ll do that soon.
If you’ve written a plugin or extension for another open source system that does this, or would like to work with me on doing so, let me know in the comments!