Neil Turner's Blog

Blogging about technology and randomness since 2002

Taking Control of URIs in Movable Type

If you notice the URL of this entry is different to the title. This is because I’ve followed these instructions and converted my file templates to use the Entry Basename instead of a ‘dirified’ title like before. Basenames are MT’s equivalent of Post Slugs in WordPress – if you have a really long entry title, you can replace it with something shorter so that the URL isn’t miles long. MT has actually supported basenames since 3.0D was released last year, but they were set internally and couldn’t be edited (well, not without manually hacking the database). Now, they can be edited along with the entry, so that you can customise them to your hearts content. Or stick with the default. Jay Allen explains the feature here and here’s Mark Pilgrim’s original ‘slugs’ entry from almost exactly 2 years ago explaining how to do something similar using the Keywords field in older versions.
The instructions I linked to at the start of the post are necessary to ensure that when you convert your file templates to use basenames the permalinks for your entries don’t all get changed (and become not-so-permalinks).
Finally, if you upgrade to Movable Type 3.2 and don’t see the Basename field, open an Edit Entry screen, scroll down to the bottom and click ‘Customize the display of this page.’ then enable Basenames. I had to do this to get the field to display – if you’ve previously customised your edit entry screens it won’t display automatically.

3 Comments

  1. Very nifty! I’ve always found the dirify function so much better than the old ID based names we used to have, but long titles looked stupid as basenames when they get cut off… now with the ability to set whatever we want, it’s so simple to make useful search engine friendly URLs. When 3.2 final comes out I’ll probably do the same thing on my blog.

  2. You can also edit the default length of the basenames so that they’re up to, say, 25 characters instead of 15.

  3. So, how do you handle the existing links? I would like to change, but not break my existing URLs.