Paul Makepeace ;-)

August 1, 2004

Movable Type URL tweaks

Posted in: Movable Type

I've been having "URL envy" for some blogs where the title of the entry appears in some form in the URL. So instead of /archives/002996.html it's /archives/that_blog_about_foo.html. Not only is that form of URL more descriptive, it's easier for me to remember, and even assists search engines in indexing the site (in other words, for search terms including the words in the URL these pages will appear higher up the results). After poking around the ever-useful Elise MT site I found how to do it.


For the record here's what I used:

  • Individual
    <$MTArchiveDate format="%Y/%m"$>/<$MTEntryTitle dirify="1" trim_to="32"$>.html

  • Monthly
    <$MTEntryDate format="%Y/%m/"$>index.html

  • Category
    <$MTArchiveCategory dirify="1"$>/index.html

Additionally, in Website Config, I set the Archive URL and Local Archive Path to be the same as the Site URL and Local Site Path, i.e. remove the archives/ path. I did this since it's already archiving under a date-based URL.

So I now have http://paulm.com/inchoate/2004/07/damp_assassins.html rather than http://paulm.com/inchoate/archives/002996.html, and referencing categories is as simple as http://paulm.com/inchoate/events/ -- much better!

Incidently, the reason for 32 in the trim length above is that it's 72chars minus the number of characters in the rest of the URL http://paulm.com/inchoate/200x/yz/.html (counted using unix's wc -c of course :-). Having URLs 72chars or less makes them pretty safe for sending in email without some poorly designed software (i.e. Outlook) breaking the URL in half.

Posted by Paul Makepeace at August 1, 2004 17:25 | TrackBack
Comments
Post a comment









Remember personal info?