I’ve been looking at the issue of getting Movable Type to produce some more friendly URLs off the back of my recent site redesign and the decision to start using PHP to build certain parts of the site. By default, MT generates pages with URLs like this:

http://www.magpiebrain.com/archives/000226.html

The first problem with such a URL is that it is by no means friendly. Secondly they are dependent on the server-side technology I’m using – for example what if I decided to produce PHP files rather than HTML? These and other issues are looked at in Jakob Nielsen’s “URL as UI”:http://www.useit.com/alertbox/990321.html and in Tim Berners-Lee’s “Cool URIs don’t change”:http://www.w3.org/Provider/Style/URI so I won’t go over them in any detail here – suffice to say if you’re interested in the subject you could do worse than read both of them.

So, once I made the decision to produce some nicer URLs with MT, I started looking around for some good examples, and found quite a few. All of them however seem to have their problems:

* Mark Pilgrim’s “Cruft-free URLs in Movable Type”:http://diveintomark.org/archives/2003/08/15/slugs uses the Keywords field to extract the title for the URL – I use the keywords to generate refined @MTSearch@ results and to drive the use of the @RelatedEntries@ plugin. The purist in me also has an issue with using a field for a purpose other than which it was intended. If this doesn’t bother you then it looks like a good solution.
* Dave Dribin “refines(Fixing Movable Type’s Permalink URLs)”:http://www.dribin.org/dave/blog/archives/2003/09/24/permalink_urls/ Mark’s approach, and only uses part of the keyword feature to create a title using his @MTEntryShortTitle@ plugin.
* Már Örlygsson’s “less involved approach(Howto: Future-proof URLs in Movable Type)”:http://mar.anomy.net/entry/2003/06/22/17.15.00/ seems more ‘hacky’ to me – it involves editing MT’s code, although might be a viable solution if you have less control over your hosting environment.

Dave Dribin’s method seems to way to go, and Shirley over at “Brainstorms and Raves”:http://www.brainstormsandraves.com/about/ seems to agree – she gives a “good write up(More on Friendly URLs)”:http://www.brainstormsandraves.com/archives/2003/09/28/urls/ on the technique. I do however agree with the sentiment that it would be far better if we got a field in MT that let us specify the name of the URL for each post – I think I’ll look into the forthcoming Movable Type V3 before I implement this myself.

_Update_ : Just after I posted this, I read a post over at phil ringnalda dot com concerning how “Google handles underscores(Underscores are bad, mmkay?)”:http://philringnalda.com/blog/2004/04/underscores_are_bad_mmkay.php in pathnames. Apparently @a_blog_post.html@ gets merged into @ablogpost.html@ rather than showing up as a series of seperate words. Many people use this technique for their URLs and it now seems like they end up damaging their Google juice. Hyphens however are OK – Google sees them as seperate words.

Advertisements