Now blogging at diego's weblog. See you over there!

rfc 822 dates in movable type

Yesterday, when I migrated to MT 3.12 I remembered that I was using a plugin to generate RFC 822 dates which MT didn't seem to be able to do. I had arrived at this solution a year ago (damn! a year ago? What the... anyway) because the basic $MTBlogTimezone$ in MT generated timezones in the format +HH:MM, while RFC 822 generally requires timezone abbreviations (e.g., GMT, PST, etc). But yesterday, while thinking about reinstalling the plugin, I rechecked the MT docs for tags and noticed that since MT 2.5 there has been a no_colon attribute for $MTBlogTimezone$ which removes the colon and thus matches one of the possible ways of specifying a timezone in RFC 822 dates, as +HHMM. The result is:

<$MTEntryDate format="%a, %d %b %Y %H:%M:%S"$> <$MTBlogTimezone no_colon="1"$>
which gets you RFC 822 compliant dates on your RSS 2.0 feeds without requiring any plugins. With this knowledge, looking specifically for these terms tells me that this is a well-known solution, but maybe it's not as clear as it should be, it certainly wasn't obvious to me when I looked for this a year ago.

Now, this solution applies to MT from 2.51 and up. MT 3x introduced a specific RFC 822 format (basically a shorter way of specifying the tags shown above), used as follows:

<$MTEntryDate format_name="rfc822"$>
Which makes the whole thing a lot easier, and which is included by default in the MT 3 templates. Cool.

Categories: technology
Posted by diego on October 24 2004 at 9:00 PM

Copyright © Diego Doval 2002-2011.
Powered by
Movable Type 4.37