Make recent comments widget on blogger

Look at the red codes , 5 is the number of comments which will be shown , and http://seoblog7.blogspot.com/ , change it with your blog url

<ul><script style="">
function showrecentcomments(json) {
for (var i = 0; i < 5; i++) {
var entry = json.feed.entry[i];
var ctlink;

if (i == json.feed.entry.length) break;
for (var k = 0; k < entry.link.length; k++) {
if (entry.link[k].rel == 'alternate') {
ctlink = entry.link[k].href;
break;
}
}
ctlink = ctlink.replace("#", "#comment-");
var ptlink = ctlink.split("#");
ptlink = ptlink[0];
var txtlink = ptlink.split("/");
txtlink = txtlink[5];
txtlink = txtlink.split(".html");
txtlink = txtlink[0];
var pttitle = txtlink.replace(/-/g," ");
pttitle = pttitle.link(ptlink);
if ("content" in entry) {
var comment = entry.content.$t;}
else
if ("summary" in entry) {
var comment = entry.summary.$t;}
else var comment = "";
var re = /<\S[^>]*>/g;
comment = comment.replace(re, "");

document.write('<li>');
document.write('<a href="' + ctlink + '">' + entry.author[0].name.$t + '</a>');
document.write(' on ' + pttitle);
document.write('<br/>');
if (comment.length < 50) {
document.write(comment);
}
else
{
comment = comment.substring(0, 50);
var quoteEnd = comment.lastIndexOf(" ");
comment = comment.substring(0, quoteEnd);
document.write(comment + '...<a href="' + ctlink + '">(more)</a>');
}
}
document.write('</li>');
document.write('<div style="font-size:75%;text-align:center"></div>');
}
</script>
<script src="http://seoblog7.blogspot.com/feeds/comments/default?alt=json-in-script&callback=showrecentcomments">
</script></ul>
<noscript>You need to enable JavaScript to read this.</noscript>

13 comments:

seo service jaipur said...

I saw your blog posting it is nice and very helpful for me. thanks

Outsource SEO said...

Well defined code. Also by making the widget span display more comments, it makes a great history track back. Speaking of trackback, the recent comments widget supports the trackback script.

seo reseller said...

The recent comment scheme also works well with auto link script for blogger and blogspot. Adding more contents based on user interactivity helps one ranks your blog.

SEO said...

I see the post like your’ share information for the help of others, it must be helpful for other's. It’s really a very beautiful and informative post.
Also by making the widget span display more comments, it makes a great history track back. Adding more contents based on user interactivity help one ranks your blog. I like you're information thank this.

Unknown said...

HI is blog posting it is nice and very helpful for every one.it makes a great history track back.thanks

Ecommerce said...

Exploring and learning how to customize your blog is really fun. It makes me excited to learn more.

Party Baggers said...

It was really fun improving your blog sites, moreover exploring more about the features to be used to beautify your page. Thank you for sharing these codes.

plumbing said...

Knowing different facilities in your blog makes your blogging an adventure.

double glazing said...

The code is really easy to understand and self-explanatory. Thank you.

Fancy Dress said...

Thanks for the tip. A lot of the readers are very happy to know these tips i'm looking forward for your next post.

playmobil train said...

Wow!
Thank you fro sharing a code for widgets. Very much appreciated. Those codes are easy to understand.

Anonymous said...

Thanks For the Post.

For more SEO related articles:
Visit:
www.honey-dollar.com

seo kerala said...

The information in this blog seems to be beautiful and also interesting.

Post a Comment