This website covers topics on knowledge management, personal effectiveness, theory of constraints, amongst other topics. Opinions expressed here are strictly those of the owner, Jack Vinson, and those of the commenters.

Updating my comment feed

For those of you who are technically advanced, I've updated some of the background aspects of this blog to include the well-formed web's CommentAPI.  I have been thinking about this for a while, but the implementation instructions seemed to be hidden -- or I was being thick.

If your feed reader understands the CommentAPI standard, you should start seeing comments threaded with the posts themselves.  Of course, I don't get that many comments, so maybe this won't be ground breaking.  For now, I will keep my "extended" feed that incorporates comments into the feed itself.  About 20% of my readers subscribe to that feed.

Keep reading if you want more detailed instructions on how to do this at your blog.  Thanks to the Movable Type ProNet for guidance.  And if you know more about this than me, please correct me in the comments.

There are two pieces required for this to work.  1) The primary feed needs an indicator that there is a wfw:commentRss feed.  2) And that comment feed needs to exist for each article.  The web feed that will be updated when comments are posted to that article.  Oh, this appears to work in both Atom and RSS, despite the name of the standard. 3) Tell your blog software that the new feed needs to be published.

First, update the primary web feed

This would be the primary atom.xml or index.xml file.  Every item in the web feed needs to have an additional line that points to the wfw:commentRss feed.  The specifics of generating it will vary, depending on the blogging platform.  For Movable Type, it is

<wfw:commentRss>
  <$MTBlogArchiveURL$><$MTEntryDate format="%Y/%m/%d"$>/<$MTEntryTitle dirify="1"$>.xml
</wfw:commentRss>

This location parallels where my individual entry archives reside.  One could make a different location decision, and that would need .  This line needs to appear within the <item> </item> tags in RSS or within the <entry> </entry> tags for Atom.  Here is an example of the resulting line:

<wfw:commentRss>http://blog.jackvinson.com/archives/2006/12/10/noknead_bread_but_i_need_bread.xml</wfw:commentRss>

Note the "wfw" prefix.  The web feed needs to know where to find this XML namespace.  On the second line XML file, you'll need to add the wfw location.  This looks a little different for RSS and for Atom:

ATOM -  <feed xmlns="http://www.w3.org/2005/Atom" xmlns:wfw="http://wellformedweb.org/CommentAPI/" >

RSS - <rss version="2.0" xmlns:wfw="http://wellformedweb.org/CommentAPI/" >

Second, create the web feed for your individual posts

The basic concept is that you want to list out each comment for the post into the XML file.  One decision: do you place the text of the original article in the file or not.  If you do, just copy the XML from your primary web feed, which is what I've done.  I am using Atom here.  Andrey Serebryakov provides the RSS formatted version of this template - note that he doesn't include the text of the article in this template.

<?xml version="1.0" encoding="<$MTPublishCharset$>"?>
<feed xmlns="http://www.w3.org/2005/Atom"
         xmlns:thr="http://purl.org/syndication/thread/1.0"
         xmlns:wfw="http://wellformedweb.org/CommentAPI/">
  <link rel="alternate" type="text/html" href="<$MTArchiveLink encode_xml="1"$>" />
  <link rel="self" type="application/atom+xml" href="<$MTBlogArchiveURL$><$MTEntryDate format="%Y/%m/%d"$>/<$MTEntryTitle dirify="1"$>.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>
    <title><$MTEntryTitle remove_html="1" encode_xml="1"$></title>
    <link rel="alternate" type="text/html" href="<$MTEntryPermalink encode_xml="1"$>" />
    <id><$MTEntryAtomID$></id>
    <published><$MTEntryDate utc="1" format="%Y-%m-%dT%H:%M:%SZ"$></published>
    <updated><$MTEntryModifiedDate utc="1" format="%Y-%m-%dT%H:%M:%SZ"$></updated>
    <summary type="text"><$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"$>" scheme="http://blog.jackvinson.com/archives/"></category>
    </MTEntryCategories>
<MTEntryTags>
  <category term="<$MTTagName$>" scheme="http://blog.jackvinson.com/tags/"></category>
</MTEntryTags>
    <content type="html" xml:lang="<$MTBlogLanguage ietf="1"$>" xml:base="<$MTBlogURL encode_xml="1"$>">
  <![CDATA[
        <$MTEntryBody$>
  <MTEntryIfExtended>  <p><a href="<$MTEntryPermalink$>#more">Read the rest of "<$MTEntryTitle$>"</a></p></MTEntryIfExtended> ]]>
    </content>
  <wfw:commentRss><$MTBlogArchiveURL$><$MTEntryDate format="%Y/%m/%d"$>/<$MTEntryTitle dirify="1"$>.xml</wfw:commentRss>
  <rights>Copyright (c) <$MTEntryDate format="%Y"$>, <$MTEntryAuthor encode_xml="1"$></rights>
  </entry>
<MTComments>
  <entry>
    <id><$MTEntryAtomID$>.<$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"$>#comment-<$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>
    <updated><$MTCommentDate utc="1" format="%Y-%m-%dT%H:%M:%SZ"$></updated>
  </entry>
</MTComments>
</feed>

Finally, hook it up

Each platform does this differently, but you need to tell the software to publish the new XML file along with everything else when new articles are posted and when new comments are added.  In Movable Type, this requires mapping an Individual archive to this XML file, which is in the Settings -> Publishing control panel.  In my case, the "Archive File Path" looks like this:

<$MTArchiveDate format="%Y/%m/%d"$>/<$MTEntryTitle dirify="1"$>.xml

This creates xml files that completely mirror the location of the html files that are created for individual entries, which seems to be a sensible way to do it.  This location has to be the same as that used in the first step of creating a reference to the commentRss file for each entry in the primary web feed.

Other thoughts / Questions

I wonder if I can extend this with Trackbacks.  If an article has Trackbacks, I could imagine doing essentially the same thing.

Is the threading namespace (xmlns:thr) required in the XML file for the individual entry?  I think not, but I've left it in there for now.

The real test is in the doing.  Let's see if this works! 

I repeat, if this is broken, or if I got something wrong, please let me know.

My wife in a book

What makes an effective knowledge worker