September 06, 2007

Enable per-post comments feeds

For a while now, I've been wondering how to enable the feed link for per-post comments in order to allow readers to subscribe to the comments for a particular post they are interested in. From what I'd read in the Blogger help groups, the only method was to create a link for each individual post including that particular post's ID number. Which would have been very tedious! However, today I finally figured out a much simpler methos, so you can simply add a bit of code to your post footer which will easily enable your readers to subscribe to the comments of a particular post of interest!

To create the link which will enable readers to subscribe to the comments of a particular post, you will need to ensure you have enabled post pages in your blog settings. If you haven't already done this, go to Settings>Archiving in your Blogger dashboard and set "Enable post pages" to "yes".

Next, find this section in your Blogger template:

<p><data:post.body/></p>
Just after this line, paste the following section of code, replacing "yourblogurl" with the url of your blog:
<p><a expr:href='"http://yourblogurl/feeds/" + data:post.id + "/comments/default"'>Post Comments Feed</a></p>

This will enable the default Atom feed for the per-post comments. If you prefer to link to the RSS comments, you should paste this section of code instead:

<p><a expr:href='"http://yourblogurl.com/feeds/" + data:post.id + "/comments/default?alt=rss"'>Post Comment Feed</a></p>
You can change the link text ("Post Comment Feed")to anything you like, such as "Subscribe to comments for this post".

Preview your template to ensure that you haven't upset the layout of your posts, then save your template and view your blog. You should now see this new link appear just beneath each of your blog posts. When you click on this link, you will be taken to a page which features the comments feed for only this particular post with the option to subscribe to this particular feed.

Technorati Tags: | | | |

Advertise on Blogger Buster

Browse through the Archives

All existing posts are still available to view while I'm working on the site, albeit seen in a much simpler interface. Feel free to browse through the archives to find tutorials, templates and articles to help you build a better blog:

Blog Archive

© Blogger Buster 2010 Home | About | Contact | Hire Me | Privacy Policy