Introducing Slugger+ for WordPress and MarsEdit

March 11, 2007

MarsEdit is great, but it's lacking one very important feature, namely the ability to specify a slug when posting to a WordPress weblog. If there is one thing that Daniel Jalkut (the new owner and maintainer of the software) needs to fix, it's this slug thing.

The whole point of MarsEdit is to provide a layer of abstraction between your words and the system that publishes your words — "an email-like interface for editing and publishing your words." To put it another way, I should never have to use the WordPress interface to post (or edit). However, as it stands now, if I'm posting something with a rather long title, that long title becomes a long slug unless I log into WordPress and change it, thereby defeating one of the main purposes of using MarsEdit to begin with.

I've no doubt Daniel will take care of this annoyance as soon as time permits, not least because he himself uses WordPress and MarsEdit and must be plagued by the same problem. But until then, I present to you Slugger+. I'm using the "+" because this is actually a simple modification of a great plugin called Slugger by Colin Devroe, which allows you to define a slug from within your post's content (Update: Colin has given Slugger+ his seal of approval). If that doesn't make sense, be sure to check out Colin's wonderful screencast of the plugin in action.

Slugger is a great solution (and is well-written) — insert your slug, wrapped in a custom tag, into the body of your post and ferret it out when needed — but it suffers from a couple of problems as far as I'm concerned.

The plugin requires you to insert into the content of your post, certain text of the form, [slug]slug-to-use[/slug]. The problem is that the plugin never actually removes this text from the content of the post, but rather filters it out each and every time the post is called (e.g., through the RSS feed, individual archive, etc.). Not only do I not like superfluous text in my posts, I hate the the idea that processor cycles are being spent on removing the now useless text (i.e., $post_name is already defined) each time the post is accessed.

My modifications fix both of these issues by removing the slug-specifying text during the initial XML-RPC transaction, thereby obviating the need to constantly filter for the slug.

In my opinion, this ‘plussed' version of Colin's plugin makes MarsEdit much more attractive to us WordPress users.

You should follow me on Twitter here