Issue with my comments-only feed
I have no idea if anyone other than myself is currently subscribing to my ‘comments only’ RSS feed, but I’ve noticed an odd issue with it that I haven’t been able to troubleshoot yet. I’ve asked for help on the TypePad User Group, but I wanted to mention it here too, in case anyone else has been noticing this or might be able to point out what I’m doing wrong.
What I’ve been finding is that each item in my comment-only feed is being given the date of the original post that the comment is appended to, rather than the date that the comment was added to my site. For instance, a comment added today to a post from August shows up in my newsreader with the August date instead of today’s.
Here’s the code I’m using for each item in the RSS feed template (the full template code can be found in this post from last week):
<MTComments lastn="20">
<MTCommentEntry>
<item>
<title><$MTEntryTitle remove_html="1" encode_xml="1"$></title>
<link><$MTEntryPermalink encode_xml="1"$>#c<$MTCommentID$></link>
<description><$MTCommentBody remove_html="1" encode_xml="1"$></description>
<guid isPermaLink="false"><$MTCommentID$>@<$MTBlogURL$></guid>
<content:encoded><![CDATA[<MTCommentAuthorLink show_email="0"> on
<MTCommentDate format="%b %e, %Y %l:%M %p">: <$MTCommentBody$>]]></content:encoded>
<dc:date><$MTCommentDate format="%Y-%m-%dT%H:%M:%S"$><$MTBlogTimezone$></dc:date>
</item>
</MTCommentEntry>
</MTComments>
Now, it all looks right to me, and the same basic code seems to be working in all the rest of my templates (for instance, in the ‘full posts plus comments’ RSS feed, each comment begins with a header that lists the correct date). For some reason, though, it’s not working here.
Any ideas?
Update: The issue has been fixed. Turns out that you can’t use an <MTCommentDate> tag inside an <MTCommentEntry> container (much thanks to Jamie Jamison for pointing me to the explanation).
The solution was fairly easy (and the code in my ‘how-to’ post has been updated): I just removed the date display from the body of the RSS item, and moved the closing <MTCommentEntry> tag up a couple lines. Here’s the new version of the above code:
<MTComments lastn="20">
<item>
<MTCommentEntry>
<title><$MTEntryTitle remove_html="1" encode_xml="1"$></title>
<link><$MTEntryPermalink encode_xml="1"$>#c<$MTCommentID$></link>
<description><$MTCommentBody remove_html="1" encode_xml="1"$></description>
<guid isPermaLink="false"><$MTCommentID$>@<$MTBlogURL$></guid>
<content:encoded><![CDATA[<MTCommentAuthorLink show_email="0">: <$MTCommentBody$>]]></content:encoded>
</MTCommentEntry>
<dc:date><$MTCommentDate format="%Y-%m-%dT%H:%M:%S"$><$MTBlogTimezone$></dc:date>
</item>
</MTComments>









Thanks for the link on the solution. I would think for the absolute in making sense, you would want to code it more like this: < MTComments lastn=”20″> < item> < MTCommentEntry> [Rest of Code] </MTCommentCentry> < dc:date><$MTCommentDate format=”%Y-%m-%dT%H:%M:%S”$><$MTBlogTimezone$></dc:date> </item> </MTComments> That way your item tags are both on the outside of your entry tag. It just seems to make more logical sense, though there wouldn’t be a reason the code wouldn’t work.
And here’s a weird one, when I tried to use the html entity for less than at the beginning of those items that have spaces, it just put in the text & l t, but if I put a space after it or if it had a punctuation mark, it used the symbol. WTF?
Thanks, Jamie, that does make a little more sense, and I’ve gone ahead and updated the code on my posts to reflect that.
As for the wierdness with the < tags at the beginning of lines, I was lost at first (as it works fine for me), but I just double-checked with the e-mail I got notifying me of your comment, and I think I see the problem.
When you were typing out the code, you were typing the HTML entities as < — but a correctly-coded entity ends with a semicolon — < — like so. Apparently Safari’s rendering engine (and quite possibly the rendering engines of other browsers) is smart enough to assume the missing semicolon in some situations, but not in all, and that’s where the wierdness was creeping in. Just remember to close out your entities with that semicolon, and you should be fine.
Fixed the comments RSS feed dates
As arved pointed out a couple of days ago, my comments RSS feeds were just so slightly wrong: the date displayed for the comments was the entry date, not that of the actual comment. Thanks to a Chasing Coffee post…