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