Dirify With Dashes in Movable Type

October 26th, 2006 Comments Off

One of the things that’s always bugged me about Movable Type is that there’s no option for the dirify text filter other than underscores. I really dislike underscores in URLs. They get hidden when a link is underlined, some people don’t understand what you mean when you try to spell out a URL with underscores in it, and you have to shift when you type them. Those are all admittedly very minor quibbles, and could even be describe as edge cases, but the fact remains that I don’t like them.


As a result, one of the things that always in the back of my mind when I’m working with Movable Type is “I need to learn how to write plug-ins so I can make a plug-in that offers some other dirify options. If you look in Six Apart’s Movable Type Plug-In Directory, you’ll find [DirifyPlus](http://www.sixapart.com/pronet/plugins/plugin/dirifyplus.html), which boasts **sixty** different combinations of options for dirifying. Killer! But it doesn’t work with MT3. Nuts.
Then I found [Roger Johansson's post about fixing dirify](http://www.456bereastreet.com/archive/200510/fixing_the_dirify_function_in_movable_type/), which was very nice, but more than I needed. He fixed some problems with non-English characters and he did it by changing the code of Movable Type itself, which I like to avoid.
I decided that I would see how to fix this with a plug-in. It couldn’t be *that* hard to do something this simple. I went to Arvind Satyanarayan’s impressive and massively useful site [Movalog](http://movalog.com) and started to read his plug-in tutorial, when I decided to see if he had already addressed this and I’d some how missed it. He hadn’t solved my exact problem, but he did address it with his post “[Cruft-Free URLs](http://www.movalog.com/archives/templates/cruftfree-urls)”, and there I found my answer. Someone in his comments linked to a plug-in written by Cal Henderson of Flickr fame, called [Dashify](http://code.iamcal.com/pl/mt3/dashify/).
What I like about Dashify is that it’s bone-simple. All it does is give you the option of using `dashify=”1″` instead of `dirify=”1″`. But that’s also what I don’t like about it. What I’d really like to have is something that gives me some options about how I’m going to dirify a particular string. Maybe I’d like to use underscores *somewhere*. I don’t know where, but what I’d really like to see is the option in Movable Type to do something like `dirify=”1″` for underscores and `dirify=”2″` for dashes. Or something similar. DirifyPlus had an interesting system.
###Oh, one other thing###
In the course of tracking this down, I also found out that Google doesn’t consider underscores in URLs dividers, but it *does* consider hyphens (dashes) dividers.
[Matt Cutts - Dashes vs. underscores](http://www.mattcutts.com/blog/dashes-vs-underscores/)
[GoogleGuy Confirms that Underscores are not Word Separators](http://www.markcarey.com/googleguy-says/archives/discuss-googleguy-confirms-that-underscores-are-not-word-separators.html)
[Google test : hyphen and underscore](http://www.prweaver.com/blog/2004/08/26/2-hyphen-and-underscore)
Those articles are all a year or two old, so Google might have changed that, but I don’t think so. If anyone knows different, let me know. Otherwise, go forth and Dashify! (Thanks, Cal!)

Comments are closed.

What's this?

You are currently reading Dirify With Dashes in Movable Type at David McCreath.

meta