Pragmatism in the real world

Shorter Links WP plugin

There is a new idea out there that enables a web page to provide an alternative shorter URL for use with services like Twitter. The general idea is that you provide a link tag in the head section and then the client that wants to shorten your URL looks for it and uses it instead of the nice long SEO-optimised version. The first service to use it is RevCanonical at revcanonical.appspot.com. Further details can be found at laughingmeme.org, shiflett.org, benramsey.com and finally Short URL Auto-Discovery.

The link created looks like this:
<link rel="shorturl" href="{shorter version of url}" />

The choice of URL to use for the short link can be configured within Settings->Shorter Links.

The Shorter Links WordPress plugin automatically creates a link element in the

section of the post’s page with rev=”canonical” and rel=”alternate shorter” attributes. The URL in the href attribute defaults to the id number of the post in question. A custom field called “Shorter link” is created once a post is saved, so that you can change the shorter link to a more memorable set of characters.

An HTTP headers is also created:
Link: <{$url}>; rel="shorturl"

Download

The Shorter Links plugin is now available from the WordPress Plugin Directory: http://wordpress.org/extend/plugins/shorter-links/

Install

  1. Install directly from within WordPress

or:

  1. Download the zip file and upzip.
  2. Upload shorter_links.php to the /wp-content/plugins/ directory
  3. Activate the plugin through the Plugins menu in WordPress
  4. If you want to set a different Base URL, then change set it from Settings->Shorter Links
  5. To set a custom shorter link, update a post so that the custom field is created and then fill in a unique value in the field.

License

Shorter Links is licensed under the New BSD license.

History

1.3 – 14 April 2009
Add support for setting the base URL. Patch by Dave Marshall.
1.2 – 13 April 2009
Only send the `Link` HTTP header.
1.1 – 13 April 2009
Fixed output of HTTP headers. Patch by Jeff Waugh.
1.0 – 11 April 2009
Initial release