Archives » December 11th, 2003

December 11, 2003

MT understood

I think I figured it out. Making Movable Type archives so the URL reads I was hoping for some kind of a mod_rewrite solution, because that would be the cleanest. weblog/2003/12/11/ would translate to weblog.html?y=2003&m=12&d=11. But I wasn’t thinking. That really only works with dynamic sites, doesn’t it? MT deals in static HTML, so things are a bit different. I realized that as I was learning how to make this happen. When MT builds URLs like that, it does so by creating all the directories it needs, so that the directory structure actually mirrors the URL. I guess when you’re dealing with static HTML, that’s how it’s gotta be. And it’s not too bad that way, I guess.

Anyway, how to do it. I found this page, which put the idea in my head, and let me know I was looking in the wrong place in the MT documentation. I was looking at Templates, I should have been looking at Weblog Config. That was the Eureka moment. That’s when it all came together.

In MT, under Weblog Config, Archiving section, there is a list of the different types of archive files the system uses. There is a field there for “Archive File Template”. Little did I know that actually meant “Archive Filename Template”. This is where you tell the system what rules it uses to create filenames. I didn’t know that. Once I wrapped my head around that, things went smoothly. There are three main templates I set up. Here’s how they break down.

  • Individual<$MTArchiveDate format="%Y/%m/%d/"$><$MTEntryTitle dirify="1"$>.html
  • Daily<$MTArchiveDate format="%Y/%m/%d/index.html"$>
  • Monthly<$MTArchiveDate format="%Y/%m/index.html"$>

I’m avoiding the weekly archives for now. But with those three set up, MT creates a 2003 directory, with subdirectories for the months, like 12, 11, and 10. And then each month has a subdirectory for the days, like 08, 09, and 10. Then, inside those directories, MT creates the static HTML with the filename based on the entry title. mt_understood.html, for example. Genius system, it really is. Those Trotts are some sharp cookies.

Now I just have to study this page and figure out how to extend MT for other things, like Sammy’s photoblog and possibly the Ormsby House galleries.