April 18, 2012

Adding threaded comments to a customized blog (Updating my Blogger Template)

Since deciding to update my Blogger template, one of the features I've been most looking forward to using is threaded comments. This enables us to reply directly in response to comments left on a post.

After diving into reams of code and going a very long way about updating my template to include this feature, I stumbled across a very simple way to add this functionality to older Blogger templates.

To help anyone else using a custom Blogger template include threaded comments for their site, I've written this quick tutorial which (unlike my original method!) should get you up and running with comment replies in no time!

Ensure your blog meets the requirements for threaded comments to be displayed

There are two main settings you should change if you would like to display threaded comments in your Blogger site:
  1. Ensure your blog feeds are set to "Full" in Settings>Other
  2. Choose to "embed" your comment form below your post in Settings>Posts and Comments
Once you have saved these settings, it's time to check your Blogger template's HTML code.

Add the required code to your Blogger template

Next, go to Template and click the Edit HTML button. On the warning page, choose to proceed, then make sure you have checked the "Expand Widget Templates" box.

Now search for the following line of code:

<b:include data='post' name='comments'/>

If your template does not include this line of code, chances are you're already using an updated Blogger template and do not need to proceed any further.

If you do find the above line of code, replace it with the following:

<b:if cond='data:post.showThreadedComments'>
  <b:include data='post' name='threaded_comments'/>
  <b:include data='post' name='comments'/>

Preview your template to ensure you haven't made any mistakes in pasting the code, and if all is well, save your template.

Now when you view a post's comments section, you should see a "Reply" link beneath any existing comments. When you reply to a comment, a comment form will appear under the comment you are responding to, and your responses will appear beneath.

Thanks to this post on the Blogger Developers Site for the simplified explanation!

Did you find this post useful?

If you've used this tutorial to update your existing Blogger template, please let us know if you found it useful in the comments section below.

Blogger Icon by Double-J Designs

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