March 18, 2006
This article reprinted from the the TypePad Hacks Weblog. The original article can be found online:
© 2008, John T Unger
Update 4.10.06: The instructions have been fixed and updated so that you can now easily create a comments feed which validates perfectly. We're all good, at last! The new code used in the tutorial was found here. Many thanks to Anu Gupta for posting them at his blog. End Update.
Update 4.10.06: Nope, the instructions are still not quite right. Apparently this is a trickier hack than I thought… I've changed the commenst feed here to use the instructions at TypePad Tips. I'd like to get the feed working so it displays comments only, as individual items, without the posts. I'll post a notice when I get the new feed to validate. End Update.
Update: 4.4.06: There was an error in the code I posted which caused comments to take on the date of the post they commented on. Thanks to Laura at the TypePad Help Desk, I think I have it all ironed out now. I've replaced the code example in this Hack with the new, improved version. If you used this tutorial for a feed from your own blog, you should replace the code too! End Update.
I read almost all the blogs I follow using RSS. Unless I want to comment on a post, or have just found a new blog via a link, I rarely see blogs in the browser. That's the way I like it— I never miss a post and I don't have to navigate all over the web to keep up. However…
Some blogs develop a community that contributes as much to the content as the author. And already, it looks like this may become one of those blogs. The readers (that's you) have been leaving some very on-target and interesting comments, which means that if you were only reading this blog via RSS you'd be missing out on half the fun! Until now, that is. Today I added a brand new feed to allow you to subscribe to the comments as well. So if you see something that makes you want to jump into the conversation, it's easy. Click the RSS icon in the sidebar that says "join the conversation" to subscribe.
For the moment, I'm planning to offer only two feeds, one for the posts and one for the comments. I feel that's the most efficient way to do it— people can subscribe to one, the other or both. If you'd like to see an additional feed that includes both, let me know in the comments section and I'll put one together.
Building this feed took me longer than I thought it would, but it won't take you any time at all: I've included simple instructions with cut+paste code in the extended entry. Follow the "continue reading" link to get it.
But first, I want to give credit to the three bloggers who posted examples that I used to work from.
Bud at TypePadTips.com posted a very clear and concise set of instructions for building a feed that includes both comments and posts. He was also really helpful when I was struggling to get it to work the way I wanted.
I tried all three of the above today, as well as various edited versions and combinations. I ended up finally using the version from revjim, verbatim, because I had the best luck validating it.
All three versions turned up with minor errors* but seem to work in most feed readers except Thunderbird. If anyone out there has a suggestion as to how to fix the code so Thunderbird can read it, I'm all ears.
*Clarification: All three of the feeds above do validate and have been in use by the owners for some time… Bud wrote to inform me that "the content of posts are often the cause of the feedvalidator 'warnings,' and not the feed itself." My mistake.
Okay, click below and let's go get you your own comments feed!
- Log into your TypePad Pro account. (You must be using advanced templates in order to create this feed.)
- Go to the Design tab for the blog to which you wish to add a comments feed.
- Click on “Create new Index Template” (in the top right corner of the page area where your templates are listed).
- Type “Comments Feed” (or whatever title you like, actually) in the “Template Name” box.
- Type “comments.rdf” in the “Output File” box.
- Paste the following code in “Template Body” box:
<?xml version="1.0" encoding="utf-8"?>
<title><$MTBlogName encode_xml="1"$> - The Conversation</title>
<description>Comments: <$MTBlogDescription encode_xml="1"$></description>
<dc:date><MTEntries lastn="1"><$MTEntryDate format_name="W3CDTF"$></MTEntries></dc:date>
<admin:generatorAgent rdf:resource="http://www.typepad.com/?v=<$MTVersion$>" />
<cc:license rdf:resource="<$MTBlogCCLicenseURL$>" />
<rdf:Seq><MTComments lastn="25" sort_order="descend">
<rdf:li rdf:resource="<MTCommentEntry><$MTEntryPermalink encode_xml="1"$></MTCommentEntry>#c<$MTCommentID$>" />
<MTComments lastn="25" sort_order="descend">
<item rdf:about="<MTCommentEntry><$MTEntryPermalink encode_xml="1"$></MTCommentEntry>#c<$MTCommentID$>">
<title>Comment by <$MTCommentAuthor encode_xml="1"$> on "<MTCommentEntry><$MTEntryTitle encode_xml="1"$></MTCommentEntry>"</title>
- Click “SAVE”.
- Click “PUBLISH”.
- Wait for the window to pop-up.
- Click “PUBLISH” on the new window.
- Announce in your blog that you now have a comments feed. Yay! You rock.
I recommend testing the feed with FEEDValidator before adding it to your sidebar.
You'll need the URL for the feed which will be http://www.yourblogname.typepad.com/comments.rdf
Once you've tested your new comments feed with FEEDValidator and tried it out in a reader or two, you'll want to add a link to it in a typelist in your sidebar. Go to feedicons.com for a copy of the "official" RSS icon that is quickly becoming the standard.