6

Short urls — rev=canonical#

 3 years ago
source link: https://solovyov.net/blog/2009/revcanonical-en/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Short urls — rev=canonical#

Just yesterday my feed reader fetched Simon Willison’s article about relatively new method of url shortening.

The idea is that url shorteners in fact are not very good thing, especially from URL term of life point of view. What if tinyurl.com is going to die? A lot of URLs will appear unusable, even if their destination is still alive. And discussion gave birth to thought that it could be nice to allow sites to specify their own short urls, even using their own url shorteners.

There is site with specification (if it can be named so), in short - you should specify it in your <head>...</head> section with such link:

<link rev="canonical" href="short-url-here">

In his article Simon tells about how he has implemented rev="canonical" in it’s own blog - I like his solution for not saving anything in database. ;) But hardcoding actual types of content is not that cool, so I’ve done small Django application - revcanonical, whose task is to generate and redirect such short links.

Every url is a two strings joined by a dot - it’s a base62-coded1 identification numbers of content type and object in database. So you can use that application for any object without any configuration. README has instructions on how to install and use application.

Of course, functionality is already incorporated into Byteflow. ;-)


  1. Digits, big and small latin letters ↩︎

Apr 2009


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK