Blogger Recent comments in the sidebar - Blogger help, tips and hacks

Blogger Recent comments in the sidebar

Note: This article assumes you are using a classic template (without the Layouts features).
Providing a handy list of recent comments is a good way to let visitors see who else is reading and commenting on your blog. Also, if they are following any of the comment threads, it will be easier for them to see at a glance if other people have joined in the discussions. This feature might sit in your sidebar and look something like this:

The date on each line will link to the page holding that particular comment so it can be read in full. Note that you can change the format of the date (and/or include the time as well) by changing the comment timestamp setting on the Settings Comments tab in Blogger.

Comments left by Blogger members will have their names linked to their profiles. Anonymous comments, or comments left as "Other" but without a URL specified, will be unlinked. If someone comments as "Other" and specifies a URL, that will be the destination of the link.

Here's the code you need to get this in your blog:

<MainPage> <h2 class="sidebar-title">Recent Comments</h2> <ul> <Blogger> <BlogItemCommentsEnabled> <BlogItemComments> <li><$BlogCommentAuthor$> // <a href="<$BlogCommentPermalinkURL$>"> <$BlogCommentDateTime$></a></li> </BlogItemComments> </BlogItemCommentsEnabled> </Blogger> </ul> </MainPage>

Copy that into the sidebar area of your template (or wherever you'd like it to display), then save and republish and you should be all set. Read on for a quick walk-through of the code.

The <MainPage> tags mean that this list will only appear on the main page of your blog. You could also put it on the archive pages, by changing this to <MainOrArchivePage> , but it wouldn't make much sense to have it on the post pages, since they already list all their comments.

The <Blogger> tag cycles us through every post on the page, while the <BlogItemCommentsEnabled> tag lets us only dispay information for posts with comments enabled. Then the <BlogItemComments> tag iterates through every comment for each post.

For the comments themselves, we chose to just display the author and the time, with a link to the comment, to keep it compact. If you want to show other information, feel free to check out the rest of our template'>">template tags for comments .

The &lt;h2> and <ul> tags are just formatting choices, which you can replace if you like. This version should work with most of our default templates, though. The screenshot above shows it in the Minima template.

Disclaimer: These aren't strictly the most recent comments, but just the comments for the post on the current page. Also, they will show in order by post, rather than by comment date/time. But in general, comments left on front page posts will tend to be the most recent, so this should be close enough and it still provides an overview of commenting activity.

Did you like this article ?
Subscribe to my RSS feed and get more blogging tips, Plus a lot more great advice to help your blog.

Related Posts by Categories

Widget by John
  1. 0 comments: Responses to “ Blogger Recent comments in the sidebar ”


 Subscribe in a reader

Latest Free Blogger Templates
Template 01 Template - 02 see more templates
demo - 01 demo - 02
Click here for Demo Click here for Demo How to Installed Tips
Download the Temp01 Download the Temp-2  

Blogger Help: Recent Comments


 Subscribe to Bloggers Help via RSS
Add to Technorati Favorites