Thursday, 2004-04-01
better permalinks
Some may have noticed that permalinks at this site now use a more informational format. I'm quite happy with the result. If you are interested in replicating the process — and use Movable Type (MT) — follow the instructions below.
Before we start, a few caveats: Setup may vary for your site and/or intended setup (the steps you'll find below worked for this site). With this specific method, you'll have to as well make sure you don't forget to input keywords for every entry.
Finally, a basic knowledge of both MT and website publishing will be assumed in the process. That said:
- Added keywords to every entry of this site (whew!) so that permalinks will remain short. Others in the MT blogosphere have used entry titles to create permalinks. As titles here tend to be very long, this would've likewise meant for very long URLs.
- Created a new Template Module (bottom of Templates page) named Permalink. This file is linked to:
templates/modules/permalink.txt
and it's contents exist in my Permalink Module. This makes life very easy. You'll see. - Created a template so that I could automate the addition of sitewide URI changes to my
.htaccess
file. The code used will ensure that old links don't break at another pointless dotcom. Find it here: Link Transfer template. - Went to Weblog Config > Archiving and input
archive/<$MTArchiveDate format="%Y/%m/%d"$>/<$MTEntryKeywords dirify="1"$>/index.html
in the Individual Archive File Template field. - Started replacing any instance of permalinks in my site with
<$MTInclude module="Permalink"$>
. This pulls in (during Rebuild) the Template Module created in step 2. In the future, you can change your permalink structure sitewide — if you use MT as a CMS, as I do. - Rebuilt entire site and crossed fingers. Thankfully, all went well.
It's very important that I credit Mark Pilgrim, whose prior art influenced/stirred my imagination. The only reason I didn't follow his method was that I wanted my URLs to end in slashes, as his didn't. If this nearly insignificant aspect doesn't hinder you, I strongly recommend his tutorial over mine.