Adding Recent Comments and Recent Posts Widgets For Blogger

This item was filled under [ News ]

I have just read Amanda’s new way to add recent comments to Blogger layout and wanted share a different Recent Comments hack that lets you show more than 5 comments and much more easier .

Advantages of This Way
  1. It will not slow down your blog’s load time.
  2. You can add both Recent posts and Recent comments with this way
  3. You can show more than 5 posts or comments with this hack.
  4. Its easy to apply codes to your template.

Adding Page Elements

Go to your  layout and click Add a Gadget , and then chose HTML / JAVASCRIPT , now type Recent Comments ( or Posts) to title and type same thing (Recent Comments ( or Posts) ) to content and save.

Adding Codes To Template

Now , go to your layout and then click Edit HTML and now check Expand Widget Templates, now find the following code :


and click here and on the page copy all codes using CTRL+A and then CTRL+C combination and paste the codes before  </head> tag.

You can set the number of posts/comments will be shown on your blog , changing the digit in orange.

var numposts = 10;  

If you did everything i told you to add this widget , now search for the title you typed for the gadget (Recent Comments ( or Posts) ) we added  and delete the lines shown in orange.

<b:widget id=’HTML1′ locked=’false’ title=’Recent Comments’ type=’HTML’>
<b:includable id=’main’>
  <!– only display title if it’s non-empty –>
  <b:if cond=’data:title != &quot;&quot;’>
    <h2 class=’title’><data:title/></h2>
  <div class=’widget-content’>
    <data:content/> >> Delete these lines
  <b:include name=’quickedit’/>

And now add the codes below to the place we deleted the lines , if you can the line in orange to “posts” it will show your recent posts in widget .

 <!– recent articles code start –>
&lt;script src=&quot;/feeds/comments/default?orderby=published&amp;amp;alt=json-in-script&amp;amp;callback=rp&quot;&gt;&lt;/script&gt;
<!– recent articles code end –>

And save. You cannot preview the widget without saving , so clicking preview will not show you the widget.

Thats all!

Be Sociable, Share!
You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

17 Comments on “Adding Recent Comments and Recent Posts Widgets For Blogger”

  • Amanda
    26 August, 2008, 14:05

    Gosu, that’s a brilliant hack! Would you mind if I update my latest post (and a couple of others) with a link to this tutorial? I’m sure a great many Blogger users will be thrilled to learn about this new and faster method of displaying recent items from feeds :)

    I’ll be using this on BB for sure, and will also work this into a new template I’m working on now 😉

    Thank you for letting me know about this!!

  • Gosu
    26 August, 2008, 14:16

    yep Amanda you can share this hack with your readers :)

  • boby
    26 August, 2008, 19:52

    I’m interested in it, but I can’t copy the code from the site. It says that I don’t have the permission… Could you upload it on GoogleDoc or something similar?

  • PALS
    27 August, 2008, 1:47

    Nice article you got there gosu.. […]

  • Karin RN
    27 August, 2008, 19:12

    Thanks! This works great!

  • 29 August, 2008, 7:25

    thanks, it works perfectly!!!

  • 29 August, 2008, 8:42

    I have posted this already on my blog but with a little bit different version:

    Check it out, btw, nice WordPress Skin, maybe you should making a forum XD

  • Holly
    15 October, 2008, 21:24

    Just so you know, nothing is showing up in orange, making this whole thing very hard to interpret.

  • 8 November, 2008, 20:50

    I have yet to install this widget of yours. Does an updated post comes up to the top list on this Recent Posts hack?


    Shrek from MyBlogLog

  • 3 January, 2009, 3:25

    it does not permit me. I couldnt save the code unfortunately.pls share it people. Thanks

  • Anthony
    9 April, 2009, 1:28

    I believe this is the same widget that is part of the blogger template NotepadChaos. It works well, but it only works if the blog is public. Being logged in, I cannot see it. When my blog was public, it was fine, but now that it is private, all my students (I’m a teacher) are not able to see it. Any fixes?

  • 18 June, 2009, 11:30

    Is there anyway i can add a summary to the recent comments and posts or edit the colors and stuff?

  • 16 July, 2009, 7:57

    I have find a quick and easy to install and customize Recent Post Widget with thumbnails. You can install it in minute with hassle-free complicated manual code installation.

    You may look at this link for more information :

  • 22 October, 2009, 5:41

    By allocating the memory at start-up, you reduce the number of times your driver calls memory allocation routines and therefore the number of situations in which it must be prepared to handle an allocation failure. ,

  • 22 October, 2009, 15:16

    Focus on long-term sustainability. ,

  • 8 March, 2011, 7:59

    Recently I have been seeing this recent comments on several blogs and was wondering how they were able to do that. I thought it was a plugin or module, but now I did understand the way it is done.

  • 16 March, 2011, 17:29

    very nice tips gosu, i’m looking for this and you got a brilliant hack.

Leave a Comment