15-Jun-2003

Naked comments

Chris Sells proposed per-article RSS feeds, making comments available through individual items in the feed. Sam Ruby jumped in and implemented it in Mombo. Can this be done in Movable Type?

The answer is yes it can. But it's complex to set up.

If you don't already have it, get Kevin Shay's MTFirstNWords plugin. You'll need it later for creating a comment title, as MT doesn't allow you to specify titles for comments.

Firstly, you need to be doing individual entry archiving. Of course, as this hack generates RSS based on comments entered, having commenting switched on makes a whole lot of sense.

In the individual archive template, comments are displayed with the <MTComments> tag. Within this block, the first thing you will probably see is a <div class="commentbody"> tag. If you change this to read <div class="commentbody" id="c<$MTCommentID pad="1"$>">, you can refer to your comments by their IDs. We will use these links in the <link> fields for each individual item in the RSS feed.

The next step is to create a new archive template. Go to Templates and create one. Call it "Individual Comment RSS".

Stick this template in it. Obviously edit it to change my data to yours:

The next step is to go to the Weblog Config->Archiving page and add an archive association. Enter the following archive file template with the new association: commentrss/<MTEntryID pad="1">.rss This will place your new RSS files in a subdirectory of your archive directory.

The last step is to have your RSS 2.0 feed refer to the comments RSS files. You can do it with this template:

Note that if you are not doing XSLT stylesheets, you should omit the "<?xml-stylesheet" line. You can see the Styling the RSS Feeds entry to learn what that line is all about.

I told you it was complex.

Posted at June 15, 2003 5:59 PM
Tag Set:
Comments

The provided Comment RSS feed produces invalid RSS.

<body xmlns="http://www.w3.org/1999/xhtml"><$MTEntryBody$></body>

should read

<body xmlns="http://www.w3.org/1999/xhtml"><$MTEntryBody encode_xml="1"$></body>

Posted by: Kerne at April 17, 2004 9:28 AM

Thank you very much, though, for these templates and instructions. It's not complex at all. Although I do wish MT supported alternative comment listing templates; that's 45 megs I'm not going to see again.

Posted by: Kerne at April 17, 2004 9:31 AM

You're welcome. The feeds validate with those templates however. You can test the feed for this page here:
http://feedvalidator.org/check.cgi?url=http://www.eight-cubed.com/blog/archives/commentrss/000118.rss

Your site needs to be valid XHTML for this to work, so YMMV.

Posted by: Jim Duff at April 18, 2004 11:24 AM

Comments are closed

Listed below are links to weblogs that reference this entry.

3776
Excerpt: Good news! I finally got SharpReader to work. It seems that, if...
Weblog: teasmoke
Tracked: April 17, 2004 9:49 AM