Shorter Links WordPress 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
- Install directly from within WordPress
or:
- Download the zip file and upzip.
- Upload shorter_links.php to the /wp-content/plugins/ directory
- Activate the plugin through the Plugins menu in WordPress
- If you want to set a different Base URL, then change set it from Settings->Shorter Links
- 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

April 12th, 2009 at 21:29 #
Works great, thank you
April 13th, 2009 at 02:00 #
The
check will never succeed in a wp_head action, and not just because the line preceding it was an echo. ;-)
I'll send you a patch to fix this up.
April 13th, 2009 at 03:02 #
Here you go (sent by email too):
http://www.gnome.org/~jdub/2009/shorter-links-headers-fix.patch
April 13th, 2009 at 06:34 #
Jeff,
Thank you very much :)
It works on my installation, but I have output buffering enabled, so missed it...
Regards,
Rob..
April 13th, 2009 at 15:31 #
Sorry to be the one to spoil the party, but RevCanonical is a notoriously bad idea. Google's Matt Cutts for one has pointed out the security implications of claiming canonical-ness rather than giving it (as they do), and if you're going to list one inbound link then you really should list them all.
A *much* better idea is to use rel=shortcut. It fits with "shortcut icon" and actually makes sense ("shortcut" means "a route shorter than the usual one", referring to the canonical URL in this instance). It avoids URI vs URL confusion, space vs underscore confusion, and most importantly REV vs REL confusion (that could result in users' sites vanishing from the Internet).
Sam
April 15th, 2009 at 11:58 #
[...] also contributed a basic bit of code to Rob Allen's Shorter Links plugin for wordpress, allowing users to specifying a base url, davedevelopment.co.uk isn't [...]
March 9th, 2010 at 22:30 #
Hi,
Thanks for the plugin! I've installed to our blog and can see the short URL in the header of single post pages, but the URLs don't work, they result in a Not Found error message.
Example: http://blog.kachingle.com/2010/03/pardon-this-brief-commercial-interruption-and-3k-post-celebration-by-masterstrack/
Short URL of same: http://blog.kachingle.com/1232
Any ideas on how to resolve this?