Saturday, October 07, 2006

Comment Feed for individual posts (updated)

I am not sure if this is a new feature or an old one that I missed. I was moderating comments on one of my recent posts when I came across this feed link under the post. It is a feed to the comments that appear only on that individual post (not the entire blog).

To view this feed link just click on your post’s title (for example you can click on “Comment Feed for individual posts” in this post), and scroll down to see the following text:

“Subscribe to: Post Comments (Atom)”

This appears on posts that have comments as well as the ones that have no comments.

The hack

For people who have removed (or wish to remove coz they use feedburner etc) the “Subscribe to: Posts (Atom)” link (that appears at the bottom of the posts section on the blog’s main page), this comment feed link will not appear on the post page. Here is a work around to have the comment feed link displayed while keeping your main page settings intact.

It requires a very small modification to your blog's template. So, if you do not wish to display the “Subscribe to: Posts(Atom)” link at the bottom of the main page but still want to display the comment feed link to an individual post on that post's page, add the lines in bold to the code in your blog:

<b:if cond='data:blog.pageType == "item"'>
<div class='feed-links'>
Subscribe to:
<b:loop values='data:links' var='f'>
<a class='feed-link' expr:href='data:f.url' expr:type='data:f.mimeType' target='_blank'><data:f.name/> (<data:f.feedType/>)</a>
</b:loop>
</div>
</b:if>

It is a simple “if” condition and to work with it you need to search for “ class='feed-links' ” and add the code in bold as shown here.

How do they make it work for an individual posts?

I don’t really know that, but let’s look at the URLs of the feeds:

Comments feed my previous post:

http://stubborn-fanatic.blogspot.com/feeds/2189603568115404259/
comments/full

Comments feed for this post:

http://stubborn-fanatic.blogspot.com/feeds/2453519588050438240/
comments/full

I am not sure what these numbers i.e. “2189603568115404259” and “2453519588050438240” are. I guess they refer to the total number of posts in all the blogs on blogger at the particular moment when you create a post (your post's simplest possible unique-ID across the entire blogger i.e. your post number). I am also not sure of this feed's exact purpose. Few people, who tend to have an elaborate discussion on a particular post, might prefer to use such a feed, otherwise I see no use. Whatever it is, it sounds like a good feature. Its presence might be useful to certain readers and its absence does no harm.

Update: I have replaced <b:if cond='data:blog.homepageUrl != data:blog.url'> in the above hack with <b:if cond='data:blog.pageType == "item"'> because the blog's default feed link was not displaying on the main page but still displaying on the label and archive pages.

0 Comments:

Other posts @ Stubborn Fanatic

Click here to view all my posts.

< ? indian bloggers # >

« | # | RingSurf | ? | »

Top of Page

Creative Commons License
This work is licensed under a
Creative Commons Attribution-ShareAlike 2.5 License.

However, prior permission is required before you can display any content from this blog on your site. The author reserves the right to demand removal of such content at any time for any reason. (Not applicable for back-linking)
Note: The author is not responsible for any loss of data or damages to your homepage as a result of using the hacks suggested here. Please observe all necessary precautions while modifying template code.

© 2006 Vivek Sanghi a.k.a Stubborn-Fanatic