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
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’>
<!– only display title if it’s non-empty –>
<b:if cond=’data:title != ""’>
<data:content/> >> Delete these lines
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 –>
<!– recent articles code end –>
And save. You cannot preview the widget without saving , so clicking preview will not show you the widget.