# Specifying rev="canonical" With HTTP


By Ben Ramsey

Published on April 12, 2009


It looks like [there's a lot of momentum behind `rev="canonical"`](http://search.twitter.com/search?q=%23revcanonical) now---and all built up within the span of about forty-eight hours. So, [while I disagree](http://benramsey.com/archives/a-revcanonical-rebuttal/) with the use of "canonical" [for semantic reasons](/blog/2009/04/summarizing-my-revcanonical-argument/) and `rev` for the potential of mass misunderstanding and improper implementation, I think I'll bite the bullet on this one for now, but time will tell what the community ultimately decides.

So, I've decided to [eat my own dog food](http://en.wikipedia.org/wiki/Eat_one's_own_dog_food). [Like Simon Willison](http://simonwillison.net/2009/Apr/11/revcanonical/), I bought my own short URL, and now all blog posts on my site include a `link` tag that covers all the bases similar to the following:

```html
<link rev="canonical" rel="alternate shorter" href="http://brtny.me/382" />
```

And all without any special WordPress plugin. For the ID, I'm simply using the WordPress post ID, which means that, if I change to another blogging tool in the future, I will need to maintain my indexes. Note that I've implemented it with both the popular `rev="canonical"` and my preferred `rel="alternate shorter"`.

[Chris Shiflett posts about the need for an HTTP header.](http://shiflett.org/blog/2009/apr/a-rev-canonical-http-header) I think this is also a good idea, for the same reasons he mentions. Chris's original recommendation is for an `X-Rev-Canonical` header, but [Stephen Paul Weber mentions the `Link` header](http://shiflett.org/blog/2009/apr/a-rev-canonical-http-header#comment-5). I think the `Link` header is the right way to go about this, since it offers an HTTP analogue of the HTML `link` element.

[`Link` is an <abbr title="Internet Engineering Task Force">IETF</abbr> proposal](http://tools.ietf.org/html/draft-nottingham-http-link-header-04) by [Mark Nottingham](http://www.mnot.net/blog/) that is still in the Internet-Draft stage, going through the [IETF](http://www.ietf.org/) process for standardization, but it's current, which is a good thing. If the community chooses to use it, though, it's interesting to note that that it states:

> Applications that don't merit a registered relation type may use an extension relation type. An extension relation type is a URI that, when dereferenced, SHOULD yield a document describing that relation type.

This means that one should not simply put "canonical" as the value for `rev`. Instead, it would be more proper to use something like "http://revcanonical.appspot.com/#canonical" until "canonical" is accepted as a [registered IANA relation type](http://www.iana.org/assignments/link-relations/). I wonder if the same is technically true of the `rel` and `rev` attributes in HTML.

For now, I've decided to cover all bases in my HTTP headers, as well, and you can see this by making a HEAD request to any blog post on my website, as seen in the following:

```http
HEAD /archives/summarizing-my-revcanonical-argument/ HTTP/1.1
Host: benramsey.com

HTTP/1.1 200 OK
Date: Sun, 12 Apr 2009 05:24:34 GMT
Link: <http://brtny.me/382>; rev="http://revcanonical.appspot.com/#canonical"; rel="alternate http://revcanonical.appspot.com/#shorter"
X-Rev-Canonical: http://brtny.me/382
Content-Type: text/html; charset=utf-8
```


