Nested archives with Movable Type

I’ve wanted nested archives on this site for a while, but didn’t get around to figuring out a way to do it until a few days ago. I wanted:

  1. a list of the months in which I posted something;
  2. each element of that list to be linked to the archive page for that month;
  3. a list of posts under each month that were published during that month; and
  4. each element of that list to be linked to the individual archive page for that particular post.

The entire point of this is to consolidate the list of individual posts with the month in which a post appears. I wanted to merge the list of individual posts with the list of months in which I posted (I’m removing both of these pages as soon as this entry runs its course).

I figured that there was no direct way to do this with Movable Type (I realized later that I was wrong; keep reading) and so I started looking at the MT Plugin Directory for a plugin, but there weren’t any that fit the bill. I tried a combination of various plugins, but still couldn’t come up with the functionality that I wanted, which I thought was rather simple.

I began whipping up something in PHP, but quickly realized that there had to be a better way; there had to be a way to do it directly through MT. It didn’t take long for me to figure it out (or for me to feel like an idiot for not trying to do it like this from the beginning).

The following is a very quick and simple way to achieve what I described above (and illustrate on my main archive page) using nothing but MT tags (I’ve included the actual markup that I use as well):

<MTArchiveList archive_type=Monthly>
<h2><a href=<$MTArchiveLink regex=noExtension$>>
<$MTArchiveTitle$></a></h2>
<ul>
<MTEntries>
<li>
<a href=<$MTEntryLink regex=noExtension$>>
<$MTEntryTitle$></a> 
(<MTEnglishOrdinal number='[MTEntryDate format=%d]'>)
</li>
</MTEntries>
</ul>
</MTArchiveList>

If you’re confused by the regex stuff in the link tags above, have a look at my post on future-proofing your URIs. The MTEnglishOrdinal tag is part of a plugin I use called DateTags; it takes in the cardinal date number and passes back ordinal numbers (i.e., 1st, 2nd, etc).

Not for nothing, but I really like the look and feel of my main archive page now. On a related note, I’ve changed the menu (the right-hand column) around a bit for archive pages — tried to make it a little more relevant/helpful.