More Dirify Options

Way back when, I changed my permalink methods so that I would end up with more useful link names. More useful to me, and perhaps to you as well. Over time, this generally worked very well. But as time wore on, I found more and more often I was creating entries for software releases and they all had the very same format that I had to put into the keywords field all the time. Blech.

The problem was that the Movable Type dirify function was dropping the hyphens (-) and the dots (.) from my entry names, when I wanted them to be in the entry link. What was I to do?

Well, I found the dirifyplus plugin not long ago and was using it for something else, so I figured that it must be able to help. Unfortunately, as it existed it couldn’t do anything. The hyphens and the dots were still dropped out of the entry title prior to creating the dirified value.

So, as any good little plugin developer might do, I hacked at the code to change it. Replacing one line of code and adding four others allowed me to specify a different formatting option that leaves those hyphens and dots in place, so I don’t have to specify the keywords field any longer – only when I have other odd characters that I really don’t want. Yay for Perl!


Posted

in

Comments

7 responses to “More Dirify Options”

  1. Chad Everett Avatar

    It’s been posted here. Essentially it required adding some items to the regex so they don’t get dropped, then creating a new option for the first character (x). It is important to note that this only works with that first character. If you use any of the other options in that position, it will use the default regex, which will remove the decimals again. I also allow hyphens. Hope this helps. Thanks for the donation!

  2. Jonathan Horak Avatar

    Could you post your modified “Dirify Plus” plugin online? I’ve banged my head against the wall for days trying to tweak the extension such that dots are preserved.

    P.S. Sending a good-faith donation via my Paypal account.

  3. Ted Avatar

    As a former sufferer of PSS, picture straighting Syndrome, there is hope. It just takes discipline and carefully averting one gaze. The first step is to realize one is afflicted, then corrective steps can be taken.

  4. Chad Everett Avatar

    You need to ask?

  5. Ted Avatar

    Do you also have the urge to straighten picture frames that are askew?

  6. Chad Everett Avatar

    Heh – I just don’t like looking at page ‘0012.html’ or something. Doesn’t tell me anything. Not a big deal if I’m out reading blogs. But if I run a search at Google, and one of the results has a reasonable page name on it and the other just a number, I’ll take the name nearly every time. Not always an indication, mind you, but I feel like it just helps to point towards the data.

    I don’t know for certain, but I also suspect that a reasonably readable page name will rank higher in Google (or other search engines) than one with just a name – probably because the words show up more (even if it is just once more). Still, I understand that not everyone is this concerned about it… 🙂

  7. Ted Avatar

    You’re a lot more ambitious than I am. I just let MT assign the next sequence to each entry. I’ve dealt with this type of situation in database structures and have concluded that description names are not particularly useful. I feel it is better just to assign a sequence number and use other descriptive fields to find the data at a later time. I consider the entry name just a way for MT to find and link the entry.