Recent comments RSS 1.0 template
Since there seems to be a bit of buzz about RSS feeds of comments today (even though it’s so last January), I thought I’d throw together an RSS 1.0 comment feed template to go with my (well, mostly Bill Kearney’s) RSS 0.91 template. Along the way, I added a plugin, since you can’t get at the entry title or the entry archive link while in MTComments context but an RSS item title of “michel v comments on Parabola’s daughter” is so much more useful than “michel v comments” or “A comment on 2318”.
We’ll need a bit more room to keep the <pre> from breaking the page, so let’s move to the extended entry, shall we?
First, the plugin: download CommentEntryTags.zip, unzip it, and put CommentEntryTags.pl in your MovableType plugins directory. That lets you use <$MTCommentEntryTitle$> inside <MTComments> to retrieve the title of the entry for the comment. It also adds <$MTCommentEntryLink$>, which returns the archive link for the entry. If you have individual entry archives with the comments displayed inline, then you just need to add comment permalinks to the individual entry template (add <a name=”<$MTCommentID pad=”1″$>”></a> just above <$MTCommentBody$>, and if you want to turn the date posted into a permalink like an entry permalink, use something like <a href=”<$MTCommentEntryLink$>#<$MTCommentID pad=”1″$>” title=”permalink for this comment”><$MTCommentDate$></a>), and then <$MTCommentEntryLink$>#<$MTCommentID pad=”1″$> will produce an RSS item link that points directly to the comment. Not using individual entry archives? Why not?
Then, the template:
<?xml version="1.0" encoding="iso-8859-1" ?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:admin="http://webns.net/mvcb/" xmlns="http://purl.org/rss/1.0/"> <channel rdf:about="<$MTBlogURL$>"> <title><$MTBlogName encode_xml="1"$> - recent comments</title> <link><$MTBlogURL$></link> <description><$MTBlogDescription encode_xml="1"$></description> <dc:language>en-us</dc:language> <dc:date><$MTDate format="%Y-%m-%dT%H:%M:%S"$><$MTBlogTimezone$></dc:date> <admin:generatorAgent rdf:resource="http://www.movabletype.org/?v=<$MTVersion$>" /> <items> <rdf:Seq><MTComments lastn="15"> <rdf:li rdf:resource="<$MTCommentEntryLink$>#<$MTCommentID pad="1"$>" /> </MTComments></rdf:Seq> </items> </channel> <MTComments lastn="15"> <item rdf:about="<$MTBlogArchiveURL$><$MTCommentEntryID pad="1"$>.php#<$MTCommentID pad="1"$>"> <title><$MTCommentAuthor$> comments on <$MTCommentEntryTitle$></title> <description><$MTCommentBody encode_xml="1"$></description> <link><$MTCommentEntryLink$>#<$MTCommentID pad="1"$></link> <dc:contributor><$MTCommentAuthor$></dc:contributor> <dc:date><$MTCommentDate format="%Y-%m-%dT%H:%M:%S"$><$MTBlogTimezone$></dc:date> </item> </MTComments> </rdf:RDF>
Let me know if it doesn’t work for you (or if it does, of course), in MT or an aggregator or as RDF: it works for me, in my aggregators and my RDF parser seems to give the right triples, but that doesn’t necessarily mean it’s right.
Ack. No! I don’t have – and don’t want – individual entry archives. How would I fiddle that plugin to give a CommentEntryID instead?
Erm, I think I’m going to answer the wrong question here, but there already is <MTCommentEntryID>, when you are in comment context. I was only doing the plugin to simplify creating URLs (and getting them to change). As long as you remember that you did it, just hardcode everything except MTCommentEntryID and MTCommentID in the URLs you create – that’s actually what I was doing until I decided to make something that I could distribute.
Is there? Oh. You’re right. For some reasons my eyes wanted to make a mockery of me when I checked the documentation. Oh dear…
*runs off quick before anyone notices him being foolish*
Phil,
With MT 2.5, the <$MTCommentEntryTitle$> went away, so I had to substitute it with this:
<MTCommentEntry><$MTEntryTitle$></MTCommentEntry>
Might want to update your template.
I wonder why it stopped working for you: it’s still working just fine for me.
actually, I just realized I am not using your plugin anymore… dumb, dumb, dumb…
oh well, its nice to know there is a way to not use your plugin to get the same desired effect now (at least for the title) I’ll add your plugin again…
duh
john
Looks like I was too thick to notice what you said about 2.5’s MTCommentEntry container, and too lazy to change, so I think I’ll just claim that I’m leaving this in place for people running 2.2, and recommend that anyone using 2.5 go steal revjim’s RSS comment template instead. That’s what I’m going to do.
new comments RDF feed
Due to some developments by Phil, and using his template and plugin for movable type, I’ve created a comments RDF
RDF Feed
With my spare time, I added a comment RDF feed using Phil’s template. I am still curious how the Unsanity guys add comments to their regular RDF feeds, but I am working on that as well. So, if you are interested in reading all the insightful comments o…
comments
I’ve added a Comments RSS Feed to revjim.net. Those of you who use RSS aggregators and wish to keep up with all of the latest revjim.net comments can subscribe to it. I HIGHLY recommend installing similar functionality on your own MovableType installat…
Comment feed.
Thanks to some sweet code by Phil Rinalda there’s now an RDF feed available for recent comments. I can think of only two steady readers that’ll care about this….