Adding Recent Comments and Recent Posts Widgets For Blogger
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 .
- It will not slow down your blog’s load time.
- You can add both Recent posts and Recent comments with this way
- You can show more than 5 posts or comments with this hack.
- 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 :
</head>
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 != ""’>
<h2 class=’title’><data:title/></h2>
</b:if>
<div class=’widget-content’>
<data:content/> >> Delete these lines
</div>
<b:include name=’quickedit’/>
</b:includable>
</b:widget>
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 –>
<script src="/feeds/comments/default?orderby=published&amp;alt=json-in-script&amp;callback=rp"></script>
<!– recent articles code end –>
And save. You cannot preview the widget without saving , so clicking preview will not show you the widget.
Thats all!
10 Comments on “Adding Recent Comments and Recent Posts Widgets For Blogger”
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!!
yep Amanda you can share this hack with your readers
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?
Thanks
Nice article you got there gosu.. [...]
Thanks! This works great!
thanks, it works perfectly!!!
I have posted this already on my blog but with a little bit different version:
http://tendou86.blogspot.com/2008/08/trick-to-get-recents-comments-and.html
Check it out, btw, nice Wordpress Skin, maybe you should making a forum XD
Just so you know, nothing is showing up in orange, making this whole thing very hard to interpret.
I have yet to install this widget of yours. Does an updated post comes up to the top list on this Recent Posts hack?
Regards
Shrek from MyBlogLog
it does not permit me. I couldnt save the code unfortunately.pls share it people. Thanks