Here is small HOWTO on exposing comments to MovableType-running blogs to RSS readers.
Note: Target MT versions are 2.64 and 2.65, I'm not sure about other ones.
Intro
The goals of exposing comments are: enabling for arbitrary RSS reader application to see comments made to blog items and to post new comments. There are several facilities developed by RSS commutity, which allow to achieve these goals:- <slash:comments> RSS 2.0 extension element, which merely contains number of comments made to the specified blog item.
- RSS 2.0 <comments> element, which provides URI of the page where comments can be viewed and added (it's usually something like http://yourblog/cgi-bin/mt-comments.cgi?entry_id=blog-item-id in MT blogs).
- <wfw:commentRss> RSS 2.0 extension element, which provides URI of comment feeds per blog item (to put it another way - returns comments made to specified blog item as RSS feed).
- <wfw:comment> RSS 2.0 extension element, which provides URI for posting comments via CommentAPI.
Step 1. Exposing number of comments made to a blog item
The simplest one. Number of comments made to the current item is available via <$MTEntryCommentCount$> MT template tag. Obviously it must be used within <MTEntries> tag, which iterates over blog items:<MTEntries lastn="15"> <item> ... <slash:comments><$MTEntryCommentCount$></slash:comments> ... </item> </MTEntries>Don't forget also to bind "slash" prefix to "http://purl.org/rss/1.0/modules/slash/" namespace URI.
Step 2. Linking to "comments to this item" page
Again simple one. MT provides enough template tags to construct URI of the Web page, where one can view and add comments. These are <$MTCGIPath$>, <$MTCommentScript$> and <$MTEntryID$>:<MTEntries lastn="15"> <item> ... <comments> <$MTCGIPath$><$MTCommentScript$>?entry_id=<$MTEntryID$> </comments> ... </item> </MTEntries>
Step 3. Exposing comments as RSS feeds
The idea is to generate separate RSS document for each blog item, which contains comments made to this item. This can be done in the same way as MT generates HTML file for each item and rebuilds it whenever a comment is made. One need to provide a template for such file and register it properly in MT admin. Here is a template:To install in into MT blog: click on "Templates" in main blog admin menu, click on "Create new archive template" link, type "Individual Comment RSS archive" in "Template Name" field, paste above template into "Template Body" text area and click Save. Next click on "Weblog config" in the main menu, click on "Archiving" link, then push "ADD NEW..." button. In the dialog select "Individual" in "Archive Type" and "Individual Comment RSS archive" in "Template" select box. Push "ADD" button. Now you've got two templates for "Individual" archive type, one for regular HTML page ("Individual Entry Archive" and make sure its radiobox is selected) and second for comments ("Individual Comment RSS archive"). Now paste "commentrss/<MTEntryID pad="1">.xml" into "Archive File Template" field for "Individual Comment RSS archive". That means MT will generate {entryid}.xml file in commentrss directory for each blog entry using provided template.
Also you need to fix "Individual Entry Archive" template a bit to generate id attribute for each comment (this allows linking to a partiluar comment by its ID). Go to "Templates", click on "Individual Entry Archive", locate "<div class="comments-body">" tag and change it to "<div class="comments-body" id="c<$MTCommentID pad="1"$>">".
Now you are ready to link generated comment RSS archives in main RSS 2.0 feed:
<MTEntries lastn="15"> <item> ... <wfw:commentRss> <$MTBlogArchiveURL encode_xml="1">commentrss/<$MTEntryID pad="1"$>.xml </wfw:commentRss> ... </item> </MTEntries>Rebuild the site and check if it works and your favorite RSS reader is able to see comments now.
Step 4. Enabling posting comments from RSS reader via CommentAPI
Well, this is the hardest part. Unfortunately I didn't found any implementation of CommentAPI for MT. MT is written in perl, so perl hackers are invited to fill the gap. As a quick workaround I decided to write a simple ASP.NET page to operate as a proxy for MT comment posting API. This aspx page merely receives a comment posted via CommentAPI, pulls out the data and posts it to MT via MT API. Really no big deal. Here it is (code behind part):Having this aspx page allows me to add <wfw:comment> element to my RSS feed enabling posting of comments from RSS readers supporting CommentAPI (such as RSS Bandit). Here is a relevant RSS 2.0 template part:
<MTEntries lastn="15"> <item> ... <wfw:comment> <$MTBlogURL$>CommentAPI2MT.aspx?entry_id=<$MTEntryID$> </wfw:comment> ... </item> </MTEntries>
That's it. Pheeew. Above recipe implemented at this blog so you can test it right now. Here is my RSS 2.0 feed MT template just if you want to see the whole puzzle done. If you site doesn't support ASP.NET, the same comment proxy logic can be easily implemented in JSP or PHP or whatever server scripting.
As usual any comments, bug reports, questions and amendments are appreciated.