Although this is about blogging, I’ve also posted this to Rants because I haven’t had chance to rant in a while. My rant is about blog permalinks with super-long URLs – ‘Sending TrackBack pings indiscriminately makes you a TrackBack spammer’ on Redemption in a Blog is an example of this. (side note: the article is worth a read)
Firstly, I’ll admit this: since changing to using URLs which have the title in, the URLs have got longer, but then I tend to keep my titles pretty short. But, if I were to post an entry called ‘The rather fantastic entry with the unnecessarily long name’, I’d end up with an url like
http://www.neilturner.me.uk/2003/Dec/28/ the_rather_fantastic_entry_with_the_unnecessarily_long_name.html. Catchy, isn’t it?
So, ladies and gentlemen, I present to you the
trim_to="x" attribute. This global attribute, which should certainly work in Movable Type 2.6+ and probably older versions too, will let you specify x, which is the maximum number of characters to use in the tag’s output. I’ve used it on my template blog since I could forsee the URLs getting quite long, although I made the mistake of selecting 15 characters – 20 is probably a better number.
How do you implement it? Here’s how I would do it:
<$MTArchiveDate format="%Y/%b/%d"$>/<$MTEntryTitle dirify="1" trim_to="20"$>.html . Bung that into your archiving configuration and you’re done. I’d do it on this blog if it were not for the fact that it would probably break all the permalinks yet again (if someone can tell me how to implement without doing that then I’d be most greatful).
There’s also the matter of underscores, which I’d love to do without if I could. I’m sure I could use Brad’s
removechars="_" attribute or something would be nice.