I had an interesting problem when I was creating my [old, Movable Type]1 archive. While I wanted to create the page in a way I’d never seen before, I couldn’t get one detail figured out before it went live.

While I’ll never claim to be a master at Movable Type, I sure like how I’ve bent it to my will. In the last year I made everything work just as I wanted, except for one thing: I didn’t know how to make conditional statements. I’m not even sure if they were, but I didn’t know how to get them to work with Movable Type’s tags.

The problem with a lack of understanding the tag system gives me this:

Before the change

While I never want to be accused of being a ‘grammar Nazi,’ it bugs me that I have ‘1 posts’ in some of the smaller archives. This bug shows up until I post the second post every month, and I’ve been too shiftless to find a solution. Luckily, one day as I was derelict in my slacking, I found the solution in the Movable Type Documentation.

Inserting this small snippet of code gave me the result I wanted:

<mt:If tag="ArchiveCount" gt="1">s</mt:if>

Now you can see that single post months have the requisite singular form, while months with multiple posts have the plural. And now I can go back to being a grammar Nazi.

After the change

I’m sure I missed this before, but it’s really helpful to have conditional tags. In fact, what I did with that small statement only hints at the power you can wield inside the template tags. Just using the built—in tag structure, you could create most–popular, most–commented, or a host of other ideas. No plugins, just tags.

  1. Just another note that this site now runs on Textpattern. Still doesn’t hurt to know that you can do this with Movable Type tags.
status: published
lastmod: '2009-01-13T23:47:13.000Z'
excerpt: I have singular post months in the archives. And I am a grammar Nazi.
author: meadowhill
categories:
  - Blog
cms: textpattern
custom:
  section: articles
  custom_1: movable+type  coding  conditional+tags