rev=canonical providing on-site link shortening
My response to the idea of using rev=”canonical” to indicate a short URL for a canonical resource. Links, implementation details, WP plugins, etc..
rev=canonical, to hint at on-site short URLs
Will it work?
My response to Save the Internet with rev=”canonical” by Chris Shiflet (edited to fit here, implementation details abstracted from Shiflet’s blog):
Here the rev=canonical goes on a canonical (long URL) page with the href attribute as a short URL – “this page is canonical and this resource links here”. Google suggested the related attribute rel=canonical should be used to show the forward location of a canonical resource to avoid duplicate content issues with search engines.
The short URL is 301 redirected (eg by sending a Location header with PHP, or you could use .htaccess, etc.). There is no actual resource at the short URL just a redirect.
I think the idea is that you use the short URL on Twitter to avoid it being shortened. Fair enough. That it redirects to the long URL. OK. And that Twitter should parse this new page and look for a rev=canonical attribute so they can provide a transparent shortened URL giving a full URL, eg onmouseover, as an option on Tweets. Err …
What I don’t now get is
- a) why twitter would use all those resources downloading and parsing millions of pages that don’t even have the relevant link element? Where’s the ROI?
- b) why if they wanted to they wouldn’t just follow links and get the HEAD and see if it redirects?
It seems (b) would be easier on resources and give the same effect from what I can tell. The only benefit of (a) then is having a parseable short URL for the linkerati to use to get to your resource.
The benefit of that over using external URL shorteners? Some boost in domain authority maybe?
Am I right?
Two other quick issues:
- What if there are two resources noted as referring back to this resource? Which is considered the canonical shortened canonical link?
- What if the shortened link is not short enough what does Twitter do now?
For chuckles I created a few rev=canonical links (using the head-meta plugin) for this page and included both the rev and rel versions.
rev and rel? what the hell?
The “rev” attribute shows a reverse relationship, eg help-page1.html with <link rel=”canonical” type=”text/html” href=”/page1.html” /> would be the help page for the step1.html page. Whilst “rel” shows a forward relationship, eg a link from the step1.html page to help-page1.html. See the HTML4 spec from the w3c for more on this.
HTML5 is due to deprecate the rev attribute. Because of this, and some other reasons many are suggesting that instead rel=”alternate shortened” or something along those lines is used instead. My money would be on rel=”short” as a forward link to a page with an on-site shortened URL.
Note that theoretically I could claim <rev=”canonical” type=”text/html” href=”http://google.com” />, i.e. this page is the canonical version of Google.com. Clearly such claims can’t be trusted hence rev and rel are only usually trusted when references are to the same internet domain. This would however mean that the technique could not be applied to URLs shortened by off-site services.
rel=alternate-shorter is better?
[note that rel=alternate-shorter would be rendered as rel=”alternate shorter” within the link tag]
Some are arguing, notably Ben Ramsey, that instead of [ab]using canonical we should use a different implementation of what is ostensibly the same idea. Generally they recommend “alternate shortened” or something along those lines as the value of the rel attribute. revcanonical.appspot.com checks for any link tag with an attribute value starting with “short”. I’d propose just using rel=short in which case but we’ll have to see if a standard emerges out of all the other possibilities.
The “alternate” keyword as used in link-ing alternate stylesheets is intended to show that the same content is being served in an alternate form. Thus those who are strong supporters of semantics generally are preferring rel=alternate-short (or one of its synonyms) to show that the content is not just a short URL version but also the same content. The problem then is that it is not just the same content but also the same format, strictly it’s not alternate! Wars start over such as this, well flame-wars anyway. I’m pretty strict on semantics, so I’m favouring the simple single declaration of short (but shorturl would probably be best).
The use of rel means we are giving canonical status rather than claiming it, which avoids teh uber 1337 ha><0rz like me from claiming canonical status of someone else’s content using rev attributes.
Some other links on rev-canonical
- akrabat.com/shorter-links/ (or sl) mentions two alternate headers to use and provides a WP plugin.
- gist.github.com/90889 using $post->ID to provide short URLs and automating the process of including the link element with the rev=canonical.
- nixonmcinnes.co.uk/2009/04/07/implementing-internet-friendly-short-urls-with-wordpress/ (or ?p=1017) another WP plugin wp_rev_canonical.php which adds link elements for rev=canonical and for rel=alternate-shorter (i.e. rel=”alternate shorter”)
- revcanonical.appspot.com service offering discovery of onsite short URLs and providing an API for the same, from one of the originators of the idea, Kellan. Note that it won’t shorten the current page as my first URL offered is not shorter – it wouldn’t be much to check for that.
- slashdot.org/article.pl?sid=09/04/12/1834205 Slashdot story about rev=canonical
- benramsey.com/archives/summarizing-my-revcanonical-argument/ (or brtny.me/382) makes a good point about the loss of efficacy of the necessary restriction of rev=canonical to the same domain, hence favours rel=alternate-shorter (but uses both on his site).