RSS Feed: Combined Comments/Trackbacks

| 4 Comments | 3 TrackBacks

Based on a question posted by George Hotelling on his weblog ("90% Crud"), I have created an MT template to output an RSS feed which combines both comments and trackbacks iinto a single feed, using the SimpleComments plugin.

Here's the template:

<?xml version="1.0" encoding="<$MTPublishCharset$>"?>
<rss version="2.0">
  <channel>
    <title><$MTBlogName$>: SimpleComments</title>
    <link><$MTBlogURL$></link>
    <description>Latest comments/trackbacks for <$MTBlogName$></description>
    <language>en-us</language>
    <lastBuildDate><$MTDate format="%a, %d %b %Y %H:%M:%S"$> <$MTBlogTimezone no_colon="1"$></lastBuildDate>
    <generator>Movable Type v<$MTVersion$></generator>
<MTSimpleComments lastn="20" sort_order="descend">
    <item>
<MTSimpleCommentIfComment>
      <title>Comment on &quot;<MTSimpleCommentEntry><$MTEntryTitle remove_html="1" encode_xml="1"$></MTSimpleCommentEntry>&quot;</title>
      <link><MTSimpleCommentEntry><$MTEntryLink$></MTSimpleCommentEntry>#comments</link>
      <description><$MTCommentBody encode_xml="1"$>
        &lt;p&gt;- <$MTCommentAuthor encode_xml="1"$>&lt;/p&gt;</description>
      <guid isPermaLink="false">comment<$MTCommentID pad="1"$>@<$MTBlogURL$></guid>
      <pubDate><$MTCommentDate format="%a, %d %b %Y %H:%M:%S"$> <$MTBlogTimezone no_colon="1"$></pubDate>
</MTSimpleCommentIfComment>
<MTSimpleCommentIfTrackback>
      <title>Trackback: &quot;<$MTPingTitle remove_html="1" encode_xml="1"$>&quot;</title>
      <link><$MTPingURL$></link>
      <description>&lt;b&gt;Excerpt:&lt;/b&gt; <$MTPingExcerpt encode_xml="1"$>&lt;br /&gt;
      &lt;b&gt;Weblog:&lt;/b&gt; <$MTPingBlogName encode_xml="1"$>&lt;br /&gt;
      &lt;b&gt;Tracked:&lt;/b&gt; <$MTPingDate format="%B %d, %Y %I:%M %p"$>&lt;br /&gt;
      <MTSimpleCommentEntry>&lt;b&gt;TB to post:&lt;/b&gt; &quot;&lt;a href="<$MTEntryPermalink$>"&gt;<$MTEntryTitle encode_xml="1"$>&lt;/a&gt;&quot;</MTSimpleCommentEntry></description>
      <guid isPermaLink="false">tbping<$MTPingID zero_pad="6"$>@<$MTBlogURL$></guid>
      <pubDate><$MTPingDate format="%a, %d %b %Y %H:%M:%S"$> <$MTBlogTimezone no_colon="1"$></pubDate>
</MTSimpleCommentIfTrackback>
    </item>
</MTSimpleComments>
  </channel>
</rss>

If you would like to use this template to create your own combined comments/trackbacks RSS feed: Download and install the SimpleComments plugin if you do not already have it. Create a new index template, give it an output file name like "simplecomments.xml", and copy the above code into the template. Save the template then rebuild.

I like this idea so much that I am going to use this as my comments/trackbacks RSS feed instead of the separate comment and trackback feeds that I was using before.

Update: Before I posted the above template, I had created a combined comment/trackback RSS feed and validated it. Later, I tried to subscribe to the feed with Radio Userland's RSS news aggregator, but the aggregator did not like it - it reported an error "field '/pcdata' not defined". This string does not appear anywhere within my RSS feed, although "/p" does as well as "CDATA".

For every field I had included in my RSS template that used the encode_xml="1" attribute, MT was encoding the data by enclosing it in a CDATA block. Radio Userland's aggregator does not seem to like this method of encoding. To allow my feed to be read in Radio Userland's aggregator, I enabled the "NoCDATA 1" option in my mt.cfg file. With this option enabled, Radio Userland's aggregator now reads my RSS feed with no complaints.

Userland has their own RSS Validator where feeds can be tested to see if Radio Userland's aggregator will successfully read them.

Update 10-Jun-2004: RSS Combined Comments/Trackback Feed template updated:

  • Comment at top of feed removed
  • ttl element removed - not necessary

3 TrackBacks

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

The Tweezer's Edge has released a template that produces a combined comments & trackbacks RSS feed, loosely based on Adam Kalsey's SimpleComments plugin (which I use on this blog). The resulting RSS feed validates, but TweezerMan reports that Radio Use... Read More

Comments Feed from In August and Everything after... on December 30, 2003 9:42 AM

I have a comments feed now (Taken from George's entry, . However, I can't get the comments and trackback feed template working, it complains it needs to be inside an MTEntry tag. It's suppose to work without being inside an... Read More

4 Comments

Thanks for telling me how to get it working. I installed Simplecomments 1.11 manually, and it worked great.

I'm getting this error:

Build error in template 'RSS 2.0 Comments and Trackbacks Index': Error in tag: The SimpleComments tag can only be used inside an entry

I'm using SimpleComments 1.11 on MT 2.65 on OpenBSD 3.4. It doesn't break my post (as far as rebuilding my index.html template , but it does prevent some other templates, such as rsd.xml from being rebuilt).

I'm going to try to step through the logs...

I saw your post on the MT forums, where it appears the problem was due to the MT Plugin Manager linking to the 1.0 version of SimpleComments.

Yeah, kadyellebee has fixed the problem. It's now linking to version 1.11 of SimpleComments. I guess no one else has had this problem, or they're not using the plug-in manager... I thought the problem might've been me - but guess not :)

I've since rebuilt my site, and it works just fine!