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!
0 comments:
Post a Comment