tiny urls in Mura CMS, or "how to add new functionality in 30 minutes"

Browsing through the 'feature requests' forum on the Mura CMS website the other day, we came across a post where somebody requested "Tiny Urls in Mura".  Tiny Urls are basically abbreviated versions of a standard Url for a webpage.  For instance, instead of having http://www.clevertechnology.com/go/blog/tiny-urls-in-Mura-CMS, you could use http://www.clevertechnology.com/?t=txM.

Other than the obvious reduction in typing, the chief advantage of these shortened urls is that they are space savers, especially important in the 140-character world of SMS and Twitter.  While there are many url-shortening services available, these come at the cost of using your own domain name in messages and tweets.

The other reason we created this plug-in was to test our skills in developing Mura plug-ins, and in doing so hopefully encourage others to do the same.  We set ourselves a limit of one hour (yes, a single hour) to create the plug-in, with the looming prospect of a client meeting only seventy minutes from when we started.  Amazingly (and we give most of the credit to Mura and it's excellent framework) we finished in half the time.  Shortened Urls and time for a pre-meeting coffee ... what more could you ask for?

Now, admittedly we took a bit more time to polish it up for others to use, and we had the advantage of leveraging a bit of existing code for installation portion of the plug-in, but even then the whole effort never amounted to more than 70-80 minutes of work.  My hope is that this serves as an inspiration to other developers who have not yet tested the Mura CMS plug-in waters to dive in headlong (the water is crisp and clean, my friends).

Installation & Instructions

First, make sure you have a recent version of the Mura CMS installed (you can find Mura here).  To install the plug-in:

  • Download TinyUrl (it is in zip format ... don't unzip it, as this is the format Mura expects it in)
  • Log into your Mura CMS administrator
  • Click on "Site Settings" in the top yellow menu bar
  • Click on the "Plug-Ins" tab
  • Click on "Browse" and select the TinyUrl.zip file you downloaded
  • Click on "Deploy"

You have now installed the plug-in.  The settings screen only requires that you check off the site assignments for each site you want to have access to this plug-in.  Once you have done this, click on "Update" and you are ready for short urls.

To add a Tiny Url to a page, simply open up the page for editing in the Site Manager, click on the "Extended Attributes" tab, and enter a short key into the "Tiny Url" field.  For example, you could enter iB or short1 or even A. The important thing is that the key is unique to a page, since duplicate keys will load the page that had the key created first.  It is also important to note that the keys are case sensitive, so "?t=BB" will not work if you have entered the key as "bb".  Click on "Publish" to save the settings.

To load a page via a Tiny Url, add ?t=[your key] to the end of your domain and site id.  For instance, http://www.clevertechnology.com/default/?t=txM will open this blog page.  If you have modified your Mura site to do away with site ids, then http://www.clevertechnology.com/?t=txM should also work.

Good luck with it, and let us know if you have any questions or discover any issues!

Download: TinyUrl Plugin for Mura CMS

Comments

Jamie Krug

Nice! I'm very excited to dig deeper into the Mura plug-in API and this is certainly encouraging!

I assume this tiny URL redirect is a 301 (permanent)?

Also, just curious -- if the full-length URL changes (new URL Title field), will a previously created tiny URL always redirect to the current one? Not that you want to be changing your URLs much, if ever, but this would provide both Tiny and Perma-link behavior. Excellent :)

July 31, 2009, 9:44 AM
Grant

@Jamie glad you like it.

The plugin uses as much 'pure' Mura as possible. The url's are generated using Mura functions so they should always redirect to the current content. The redirect is from contentRenderer.redirect(). I don't think this specifically specifies "permanent", but it would be easy to modify either the Mura code (in your local contentRenderer, of course) or the plugin itself.

Or, you could always suggest this to the Mura team ... your SEO title's post worked wonders that way!

July 31, 2009, 10:06 AM
Matt Levine

AWESOME!

July 31, 2009, 3:58 PM
Ronnie

Have you ever used this with Stumble Upon's new Su.pr service? They have a URL shortner code for posting StumbleUpon links, but it's in php :-(

November 16, 2009, 1:12 PM
Stephen Stick Hazen

Is the tiny url only ?t=j38 format or can it be /?cat=37 format? I am moving a WordPress site to Mura and need to be able to redirect pages from the old WP site to the new Mura site.

May 4, 2010, 10:25 AM
Stephen Stick Hazen

If I needed the tiny url to work on calendars and galleries would the only place to add the code on the plugin.cfc

May 5, 2010, 9:38 AM
Post a Comment

Required Field

« September 2010 »
S M T W T F S
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30    

©Copyright 2010 Clever Technology, all rights reserved