RSS Feed for Comments

| 9 Comments | 8 TrackBacks

I've created an RSS feed for my comments so I could view new comments in my news reader. To figure out how to what needed to be in the template, I looked at sample RSS comments templates from Phil Ringnalda and Adam Kalsey, my old RSS comment feeds from HaloScan and Radio Userland, and a copy of the RSS 2.0 specification.

This is the template I came up with:

<?xml version="1.0" encoding="<$MTPublishCharset$>"?>
<rss version="2.0">
  <channel>
    <title><$MTBlogName remove_html="1" encode_html="1"$>: Comments</title>
    <link><$MTBlogURL$></link>
    <description>Latest comments for <$MTBlogName remove_html="1" encode_html="1"$></description>
    <language>en-us</language>
    <lastBuildDate><MTComments lastn="1"><$MTCommentDate language="en" format="%a, %d %b %Y %H:%M:%S"$> <$MTBlogTimezone no_colon="1"$></MTComments></lastBuildDate>
    <generator>http://www.movabletype.org/?v=<$MTVersion$></generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
<MTComments lastn="20" sort_order="descend">
    <item>
      <title>Comment on ><MTCommentEntry><$MTEntryTitle remove_html="1" encode_html="1"$></MTCommentEntry>></title>
      <link><MTCommentEntry><$MTEntryPermalink$>#comments</MTCommentEntry></link>
      <description><$MTCommentBody encode_html="1"$>
        &lt;p&gt;- <$MTCommentAuthorLink show_email="0" encode_html="1"$>&lt;/p&gt;</description>
      <guid isPermaLink="false">comment<$MTCommentID pad="1"$>@<$MTBlogURL$></guid>
      <pubDate><$MTCommentDate language="en" format="%a, %d %b %Y %H:%M:%S"$> <$MTBlogTimezone no_colon="1"$></pubDate>
    </item>
</MTComments>
  </channel>
</rss>

If you would like to use this template to create your own comments RSS feed: Create a new index template, give it an output file name like "comments.xml", and copy the above code into the template. Save the template then rebuild.

Update 13-May-2004: RSS Comment Feed template updated:

  • encode_xml attributes replaced with encode_html attributes
  • remove_html and encode_html attributes added to MTBlogName tags in channel title and description elements
  • language="en" attribute added to date tags
  • lastBuildDate element changed from date of rebuild to date of last comment
  • pubDate element added - shows last rebuild date
  • Text of generator element changed
  • docs element added
  • Within item link element, MTEntryLink tag changed to MTEntryPermalink tag
  • Within item description element, MTCommentAuthor tag replaced with MTCommentAuthorLink tag, and added show_email="0" to suppress e-mail addresses in feed

Update 10-Jun-2004: RSS Comment Feed template updated again:

  • pubDate element removed from <channel> - rebuilding feed shouldn't make feed appear changed unless something really has
  • ttl element removed - not necessary

8 TrackBacks

Wow, the sound of my own hand slapping my forehead with a loud, "duh!". The TweezerMan (not sure if I want to know the story behind that name) has provided easy to copy templates for creating RSS Feeds for Trackbacks... Read More

I now have an RSS feed of the latest comments on this site, thanks to this template and Brian for explaining away my disconnect with RSS comment feeds. There's usually some good information posted in the comments section and now... Read More

New: an RSS feed for comments Read More

Adding a comment feed from My hovercraft is full of eels on February 6, 2004 5:37 PM

I found an article detailing how to add a comment feed to a Movable Type blog. I made a few changes (as one does) and now you can subscribe to the comments on this blog as well as the main... Read More

So, kwc and I were talking earlier about a comment feed system for MovableTypo. And we came up with a couple of things, a couple of which are currently implemented on my blog. Whole-blog comment feeds [subscribe], thanks to the... Read More

RSS Comments from GregsOpinion.com on February 5, 2005 10:35 AM

Pardon the navel-gazing, but ... Just added an RSS Feed for the comments herein. Based on template found at Tweezer's Edge. More fun for RSS feeders out there.... Read More

Announcement from Daily Pundit on July 5, 2006 10:15 PM

I've added a comments rss feed to the other feeds listed on the left side column. The code was written by The Tweezer's Edge v3: RSS Feed for Comments, and I've set it to give you the last fifty comments... Read More

Ce billet expose les différents types de flux RSS que l'on peut trouver sur un blog. Il propose une série d'habillages pour Movable Type afin de combler les lacunes de ce dernier et d'ajouter les flux manquant (commentaires pour le site, flux RSS par... Read More

9 Comments

Love this, thanks TM =)

Thanks tweezer....Works great!

This is freakin' GREAT! Just what I was looking for and it works perfectly.

This comments feed looks nice. Is there an rss feed that mixes posts, comments and trackbacks together? It would be nice to get it all together.

An RSS feed can certainly be made that combines entries with comments and trackbacks, but I have never built such a feed. I'm not sure that combining all 3 would really be all that useful. I've seen some sites (such as Phil Ringnalda's) that have individual entry feeds, where each entry has its own feed with the (single) entry text along with any comments or trackbacks made on that entry.

Thanks a lot Tweezerman, just what I needed. Works great!
Regards form The Netherlands, Leon

Thanks! Just integrated: Works swell.

Ah, this is perfect! I was going mad trying to sort it out myself.

Thanks.

you're a big help Tweezer! I made a feed for my comments too :) Thanks so much!