Content Management
Creating a comments feed
20 Sep 2002
Lawrence asked how to create an RSS feed for your comments like mine. I’ll probably make some changes to my feed, but here’s how it’s currently done.
Create a new Index template in Movable Type with an output filename of something like comments.xml
and use something like this for the template contents:
<?xml version="1.0"?>
<rss version="0.91">
<channel>
<title><$MTBlogName$> Recent Comments</title>
<link><$MTBlogURL$></link>
<description>Recent comments on the Kalsey Consulting
Group weblog.</description>
<language>en-us</language>
<image>
<link><$MTBlogURL$></link>
<url>http://www.kalsey.com/images/kalseybanner.gif</url>
<title><$MTBlogName$> Recent Comments</title>
</image>
<copyright>Copyright 2002 Kalsey Consulting Group.
Permission granted for non-comercial
use.</copyright>
<webMaster>info@kalsey.com</webMaster>
<lastBuildDate>
<$MTDate format="%B %d, %Y %I:%M %p"$>
</lastBuildDate>
<MTEntries recently_commented_on="6">
<item>
<title><$MTEntryTitle encode_html="1"$>
(<$MTEntryCommentCount$> Comments)</title>
<description><MTEntryExcerpt no_generate="1" encode_xml="1">
<MTComments encode_xml="1" lastn="5">
<p><MTCommentAuthor> on
<MTCommentDate format="%b %e, %Y %l:%M %p"> |
<MTCommentBody trim_to="200" convert_breaks="0"
remove_html="1">...</p>
</MTComments></description>
<link><$MTEntryLink$>#comments</link>
</item>
</MTEntries>
</channel>
</rss>
Of course you’ll need to change the title, description, copyright, and email address, but you get the idea. You can also adjust how many entries are displayed and how many comments for each entry are included by altering the lastn values in the template.
You’ll also need to make sure that all MT tags are on one line. MT won’t process tags with a line break in them.