Joost de Valk wrote a great WordPress plugin that I'm about to install. From Joost de Valk:

http://yoast.com/twitter-analytics/?utm_source=twitter&utm_medium=twitter&utm_campaign=twitter

has a bunch of tracking parameters on it, and therefore is duplicate … so we may cite a canonical URL in <head> to fix this —

<link rel="canonical" href="http://yoast.com/twitter/analytics/"/>

In this case it is the only option to do so because Google Analytics requires the page be sent, so it is not an option to simply 301 to the canonical URL afterwards. Originally I had said it was; thanks to mark @ useyourweb for pointing this embarrassing lapse in reason to me. However, with regard to server-side campaign tracking (as would be the case in non-hosted Google Analytics as well), I still maintain that it is not ideal.

The real usefulness of rel=canonical is to deal with a different (and until now unsolvable problem). When I used to work for Barry Schwartz over at RustyBrick, I discussed with him at length how to deal with 1 product in 2 categories, while maintaining state (for breadcrumbs). So if we had 1 product in N categories, we end up with N URLs —

http://www.example.com/Foo/My-Product.html
http://www.example.com/Bar/My-Product.html
http://www.example.com/Baz/My-Product.html

Barry and I never really came up with a solution we both liked 100%. Barry?

In my book, Search Engine Optimization with PHP, I recommend setting 1 category as primary, and then excluding the non-primary URLs with a SQL query. That was the best solution I'd mustered over the years.

So let's make http://www.example.com/Foo/My-Product.html Primary, and exlude the rest in robots.txt —

User-agent: *
Disallow: /Bar/My-Product.html
Disallow: /Baz/My-Product.html

But the problem is that it basically throws some link-equity out the window. You can't stop people from linking to the non-canonical URLs … nor can you redirect because you need the state!

But now it would seem that we can use rel=canonical to resolve that problem. So we may simply place this in the head of the document —

<link rel="canonical" href="http://www.example.com/Foo/My-Product.html">

But it's still better to use the good ol' 301 when possible. It's computationally cheaper for search engines, so I'd expect it to work better. And it's more proven. Certain redirects in Yahoo! have been screwy for years at a time. Why chance it?

Tell an amigo:
  • Sphinn
  • Digg
  • Reddit
  • del.icio.us
  • StumbleUpon
  • Facebook



Related posts:
A (not so simple) method to add rel="nofollow" to links I wrote this script so that I can run it...
URL Normalization; Slashing Duplicate Content To be honest, I'm not even sure this matters much...
URL Canonicalization (/ vs. index.php) Unfortunately, the concept of "index" pages (index.php, Default.asp, etc.), a...
Matt Cutts Wages Jihad On Paid Links In Google's latest blatant exhibition of ridiculousness, Matt Cutts has...
Does URL Parameter Order Matter? This is a question I'm currently researching. I have never...