I’ve made a couple of minor changes to the RSS Feed for my blog. It’s still RSS 0.91 (I haven’t had the time to get to grips with about 1.0 or 2.0 yet–but soon!), but now it’s valid RSS 0.91, as validated by Mark Pilgim and Sam Ruby’s new RSS validation service.
The main change involved the lastBuildDate and pubDate elements, which have to be in RFC 822 format (e.g., Fri, 25 Oct 2002 07:04:23 +0100
). Movable Type can generate a date like this quite happily: <$MTEntryDate format="%a, %d %b %Y %H:%M:%S +0100" $>
. But the problem with this is that the time zone (+0100) is now hard-coded. If you change the Time Zone setting in your blog preferences, the RSS feed won’t match up any more.
Not that big a deal, really, but it’s not as elegant as having it pick up the time zone automatically. Movable Type does actually have a time zone element (<$MTBlogTimeZone$>
), but it generates the time zone with a colon in the middle, i.e. as “+01:00”.
John Gruber has put together a new MT plugin which provides the time zone in RFC 822 format. You can use this to build up a proper, dynamic RFC 822 date like so: <$MTEntryDate format="%a, %d %b %Y %H:%M:%S" $> <$MTrfc822BlogTimeZone$>
. Note that you do need that space between the two tags–if you cut-and-paste from the sample code in the plugin documentation, it’s not there.
Alternatively, you can use Brad Choate’s regex plugin. This doesn’t give you an extra tag, but instead allows you to apply a regular expression to the output of a standard MT tag, like so: <$MTBlogTimezone regex="s/://"$>
.