Links to this post



Best Recent Comments w/ Summaries Script for Blogger

Have you wanted to display more than the usual limited 5 Comments offered by the Blogger widget on your page ? along with the Summaries of those Comments ? Well , here is the Ultimate Widget which will allow you to display more than 10 comments & their summaries ! ......



Yes, I understand your plight , all you Bloggers of the infinite Cyber-sphere who would like to display more than the usual alloted measly 5 comments with NO summaries which the Blogger Platform offers presently . Well, search no longer - because I will now give you the ultimate script for exactly this purpose ! Arent you happy ? yes.....I know you are - but I'm even happier to give it to you, because this script will allow you to display up to 25 Comments along with their summaries ! . Well, are you ready to get down to business ? Good ......

Let's get started then :)

Ok , I would like you to go to your Dashboard > Layout > Page Elements > Add a Gadget :

Are you with me so far ? Good - lets continue then :

* Please choose to add a Gadget & choose the HTML/JAVASCRIPT gadget . Once the window opens up , please copy the code below and add it in this box . Please also ADD THE TITLE : "RECENT COMMENTS or LATEST COMMENTS this way you will be able to identify the widget when you are in your Page Elements Editing section ok ? Good . Now , copy the entire code below please :




    <ul style="font-style: italic;"><script style="text/javascript">

    function showrecentcomments(json) {

    for (var i = 0; i < 8; 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 style="text-align:left">');

    document.write('<a href="' + ctlink + '">' + entry.author[0].name.$t + '</a>');

    document.write(' on ' + pttitle);

    document.write('<br>');

    if (comment.length < 150) {

    document.write(comment + '...<a href="' + ctlink + '"> (more)</a><br><br>');

    }

    else

    {

    comment = comment.substring(0, 150);

    var quoteEnd = comment.lastIndexOf(" ");

    comment = comment.substring(0, quoteEnd);

    document.write(comment + '...<a href="' + ctlink + '"> (more)</a><br><br>');

    }

    }

    document.write('</li>');

    }

    </script>

    <script src="http://YOUR TITLE HERE.blogspot.com/feeds/comments/default?alt=json-in-script&callback=showrecentcomments">

    </script></ul>




Please note : You can make further customizations by changing the value 20 (var i = 0; i <>higher or lower value, this value is for the number of comments and you can't have more than 25 comments. Last thing you can modify is font-style: italic; which you can change to font-style: bold; or font-style: normal; to change the font styling.

Now please hit the SAVE feature , and your Recent Comments w/ Summaries will appear on your main page once you view your Blog page . I hope you have enjoyed this article and moreover your new Comment Widget. Enjoy , and keep smiling , Mootools & JQuery love ya & more is coming your way so stay tuned :)




Mia Zoe .








Share/Save/Bookmark