Simon Willison has an awesome post up talking about his rev=canonical bookmarklet, and designing shorter URLs by casting unique IDs to base 62 (We’re using the same trick on flic.kr to avoid having to maintain a look up database, though we’re using base 58). He details designing his new short URLs, deploying them on Django, and built a handly bookmarklet.
The nice thing about this approach is that it makes it trivial to add custom URL shortening domains to other projects—a quick view function and a few lines of nginx configuration are all that is needed.
Bookmarklet: Shorten (drag to your browser toolbar)
Chris Shiflett has a great blog post up explaining rev=”canonical” in a bit more depth, good read, especially if you’re confused:
The premise is pretty simple. In order to avoid the great linkrot apocalypse, we can opt to specify short URLs for our own pages, so that compliant services (adoption is still low, because the idea is pretty fresh) will use our short URLs instead of TinyURL.com (or some other third-party alternative) replacements. – Chris Shiflett
Re-posting my post URL Shortening Hinting:
We’ve been playing with coding up a URL shortener at Flickr this week. A URL shortener that only shortens Flickr URLs. (and right now only shortens URLs to photo pages)
Amazingly enough, this stodgiest of all conversations is a hot topic this week, with joshua’s url shorteners considered harmful post acting as something of a catalyst. Though the slick looking working on DiggBar has to be on folks mind.
Meanwhile I was curious if there a proposed rel=”alternate” syntax floating around for sites that run their own URL shortener?. I thought Dave posted one as part of his call for sites to run their owner shorteners, but I can’t find any evidence that this is correct memory.
Kevin Marks suggested rel=”canonical” and when I said that was the opposite of what I wanted replied rev=”canonical” is by definition the opposite of rel=”canonical”, but in practice people don’t grok rev. I had never heard of “link rev”, but lose the idea of marking up pages with their canonical opposites. But is that correct?
Les Orchard suggested the probably more practical rel=”shorter-alternative”, with Jon Williams refining to “rel=”shorter alternative” because IIRC rel values are like CSS classes“.
All of this implicitly based on the Mark’s work on RSS auto-discovery.
I realize this probably reads like a blow by blow description of watching paint dry.
But I’d like to pretend we’ve got some momentum here, maybe we could solve all the world’s problems my dinner time. (or at least auto-discovering url shortening problems)
update 2009/4/6: And I’ve published my rev=”canonical” URL shortening service