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

16 thoughts on “Shorter Links WP plugin

  1. The if (!headers_sent()) 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.

  2. Jeff,

    Thank you very much :)

    It works on my installation, but I have output buffering enabled, so missed it…

    Regards,

    Rob..

  3. 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

  4. Rob:
    I have a couple of websites under development that were migrated to WordPress v3 this weekend. I was hoping your plugin would work, although your plugin reference at WordPress.org indicates being compatible up to v2.9.2. The plugin installs but when I try to access your area under Dashboard – Settings I get the following message “You do not have sufficient permissions to access this page.” I am the administrator of both sites and I get the same message.

    Your plugin is straightforward and a small 4K in size unlike other plugins of this category. Are you going to update your plugin for v3, and, if so, when?

    Thanks,
    Tomr

  5. hanks 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.

  6. I’m currently developing for a site, WP 3.0.1 and installed your latest version of the plugin, which is supposed to be compatible up to 3.0.1.

    However I get the same error as Tomr did, “”You do not have sufficient permissions to access this page.”

    Like him, I am an administrator (the original install account too).

    Ideas?

  7. TomR, Chris,

    The plug in is running fine here on WP 3.0.1. I’ll do a brand new install and see if I can find out what’s happening.

    Rob…

Comments are closed.