Creating Comment Feeds
Site Wide Comment Feeds
To add a comment feed for your entire blog, create an index template that contains the following contents. Set the output of the Index Template to comments.xml.
Atom (recommended)
<$MTHTTPContentType type="application/atom+xml"$><?xml version="1.0" encoding="<$MTPublishCharset$>"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:thr="http://purl.org/syndication/thread/1.0">
<title>Comment Feed for <mt:BlogName encode_xml="1"></title>
<id>tag:<$MTBlogHost exclude_port="1" encode_xml="1"$>,<$MTTemplateCreatedOn format="%Y-%m-%d"$>:<$MTBlogRelativeURL encode_xml="1"$>/comments</id>
<updated><MTComments lastn="1"><$MTCommentDate utc="1" format="%Y-%m-%dT%H:%M:%SZ"$></MTComments></updated>
<link rel="self" href="<mt:BlogURL>comments.xml" />
<generator uri="http://www.sixapart.com/movabletype/"><$MTProductName version="1"$></generator>
<mt:Comments lastn="20">
<entry>
<mt:CommentEntry>
<id><$MTEntryAtomID$>-comment:<$MTCommentID$></id>
<mt:ifcommentparent>
<thr:in-reply-to ref="<$MTEntryAtomID$>-comment:<mt:CommentParentID>" type="text/html" href="<$MTEntryPermalink encode_xml="1"$>#comment-<mt:CommentParentID>"/>
<mt:else>
<thr:in-reply-to ref="<$MTEntryAtomID$>" type="text/html" href="<$MTEntryPermalink encode_xml="1"$>"/>
</mt:ifcommentparent>
<link rel="alternate" type="text/html" href="<$MTEntryPermalink encode_xml="1"$>#c<$MTCommentID$>" />
<title>Comment from <$MTCommentAuthor encode_xml="1"$> on <$MTCommentDate format="%Y-%m-%d"$></title>
<author>
<name><$MTCommentAuthor encode_xml="1"$></name>
<mt:if tag="commenturl"><uri><$MTCommentURL encode_xml="1"$></uri></mt:if>
</author>
<content type="html" xml:lang="<$MTBlogLanguage ietf="1"$>" xml:base="<$MTCommentURL encode_xml="1"$>">
<$MTCommentBody encode_xml="1"$>
</content>
<published><$MTCommentDate utc="1" format="%Y-%m-%dT%H:%M:%SZ"$></published>
<updated><$MTCommentDate utc="1" format="%Y-%m-%dT%H:%M:%SZ"$></updated>
</mt:CommentEntry>
</entry>
</mt:Comments>
</feed>
RSS
<$MTHTTPContentType type="application/rss+xml"$><?xml version="1.0" encoding="<$MTPublishCharset$>"?>
<rss version="2.0">
<channel>
<title><$MTBlogName remove_html="1" encode_xml="1"$>Comments</title>
<link><$MTBlogURL$></link>
<description><$MTBlogDescription remove_html="1" encode_xml="1"$></description>
<language><$MTBlogLanguage ietf="1"$></language>
<copyright>Copyright <$MTDate format="%Y"$></copyright>
<lastBuildDate><MTEntries lastn="1"><$MTEntryDate format_name="rfc822"$></MTEntries></lastBuildDate>
<generator>http://www.sixapart.com/movabletype/</generator>
<docs>http://blogs.law.harvard.edu/tech/rss</docs>
<MTComments lastn="15">
<item>
<title><$MTCommentAuthor remove_html="1" encode_xml="1"$> said: <$MTCommentBody trim_to="100" encode_xml="1" convert_breaks="0"$></title>
<description>
<$MTCommentAuthor remove_html="1" encode_xml="1"$> said: <br /><br />
<$MTCommentBody encode_xml="1"$><br /><br />
on the entry <a href="<MTCommentEntry><$MTEntryPermalink encode_xml="1"$></MTCommentEntry>"><MTCommentEntry><MTEntryTitle></MTCommentEntry></a>
</description>
<link><MTCommentEntry><$MTEntryPermalink encode_xml="1"$>#comment-<$MTCommentID$></MTCommentEntry></link>
<guid><MTCommentEntry><$MTEntryPermalink encode_xml="1"$>#comment-<$MTCommentID$></MTCommentEntry></guid>
<pubDate><$MTCommentDate format_name="rfc822"$></pubDate>
</item>
</MTComments>
</channel>
</rss>
Per-Entry Comment Feeds
To create a comments feed for each entry create an Entry Archive Template with the following contents. Then set the mapping for that template to output a .xml version of the "individual entry archive." Here is a screenshot of what just such a mapping might look like (this creates a mapping for both pages and entries:
This mapping would be applied to your comment feed, which follows:
<?xml version="1.0" encoding="<$MTPublishCharset$>"?>
<feed xmlns="http://www.w3.org/2005/Atom"
xmlns:thr="http://purl.org/syndication/thread/1.0">
<link rel="alternate" type="text/html" href="<$MTArchiveLink encode_xml="1"$>" />
<link rel="self" type="application/atom+xml" href="<$MTBlogURL$>atom.xml" />
<id>tag:<$MTBlogHost exclude_port="1" encode_xml="1"$>,<$MTDate format="%Y"$>:<$MTBlogRelativeURL encode_xml="1"$>/<$MTBlogID$>/<$MTEntryAtomID$>-</id>
<updated><MTComments lastn="1"><$MTDate utc="1" format="%Y-%m-%dT%H:%M:%SZ"$></MTComments></updated>
<title>Comments for <$MTArchiveTitle remove_html="1" encode_xml="1"$></title>
<MTIfNonEmpty tag="MTBlogDescription"><subtitle><$MTBlogDescription remove_html="1" encode_xml="1"$></subtitle></MTIfNonEmpty>
<generator uri="http://www.sixapart.com/movabletype/">Movable Type <$MTVersion$></generator>
<entry>
<id><$MTEntryAtomID$></id>
<link rel="alternate" type="text/html" href="<$MTEntryPermalink encode_xml="1"$>" />
<link rel="service.edit" type="application/atom+xml" href="<$MTCGIPath$><$MTAtomScript$>/weblog/blog_id=<$MTBlogID$>/entry_id=<$MTEntryID$>" title="<$MTEntryTitle encode_html="1"$>" />
<published><$MTEntryDate utc="1" format="%Y-%m-%dT%H:%M:%SZ"$></published>
<updated><$MTEntryModifiedDate utc="1" format="%Y-%m-%dT%H:%M:%SZ"$></updated>
<title><$MTEntryTitle remove_html="1" encode_xml="1"$></title>
<summary><$MTEntryExcerpt remove_html="1" encode_xml="1"$></summary>
<author>
<name><$MTEntryAuthorDisplayName encode_xml="1"$></name>
<MTIfNonEmpty tag="MTEntryAuthorURL"><uri><$MTEntryAuthorURL encode_xml="1"$></uri></MTIfNonEmpty>
</author>
<MTEntryCategories>
<category term="<$MTCategoryLabel encode_xml="1"$>" />
</MTEntryCategories>
<content type="html" xml:lang="<$MTBlogLanguage ietf="1"$>" xml:base="<$MTBlogURL encode_xml="1"$>">
<$MTEntryBody encode_xml="1"$>
<$MTEntryMore encode_xml="1"$>
</content>
</entry>
<MTComments>
<entry>
<id><$MTEntryAtomID$>-comment:<$MTCommentID$></id>
<thr:in-reply-to ref="<$MTEntryAtomID$>" type="text/html" href="<$MTEntryPermalink encode_xml="1"$>"/>
<link rel="alternate" type="text/html" href="<$MTEntryPermalink encode_xml="1"$>#c<$MTCommentID$>" />
<title>Comment from <$MTCommentAuthor encode_xml="1"$> on <$MTCommentDate format="%Y-%m-%d"$></title>
<author>
<name><$MTCommentAuthor encode_xml="1"$></name>
<uri><$MTCommentURL encode_xml="1"$></uri>
</author>
<content type="html" xml:lang="<$MTBlogLanguage ietf="1"$>" xml:base="<$MTCommentURL encode_xml="1"$>">
<$MTCommentBody encode_xml="1"$>
</content>
<published><$MTCommentDate utc="1" format="%Y-%m-%dT%H:%M:%SZ"$></published>
</entry>
</MTComments>
</feed>
Finally, you will need to point your Entry Archive template and your Page Archive template at your comment feeds. This is done by editing your Header template and adding the following code:
<MTIf name="page_template">
<link rel="alternate" type="application/atom+xml" href="<$MTBlogURL$><$mt:FileTemplate format="%-c/%-F-comments.xml" encode_xml="1"$>" title="Comments">
</MTIf>
<MTIf name="entry_template">
<link rel="alternate" type="application/atom+xml" href="<$MTBlogURL$><$mt:FileTemplate format="%C/%F-comments.xml" encode_xml="1"$>" title="Comments">
</MTIf>
It is critical that the mapping you use in the user interface (see screenshot above) is identical to the mapping you use in your <mt:FileTemplate> template tag.