April 2, 2015

Kode Widget Komentar Terbaru & Posting Paling Banyak Dikomentari

April 2, 2015

Posting Paling Banyak Dikomentari
CARA menampilkan, membuat, atau memasang widget "Komentar Terbaru" (Latest/Recent Comments) dan "Posting Paling Banyak Dikomentari" (Most Commented Posts) Fast Loading di blog sangat mudah. Tinggal copas atau pasang kode tertentu, beres!

Memasang widget Komentar Terbaru & Posting Paling Banyak Dikomentari di sidebar atau di footer termasuk bagian dari Internal Link Building dan membangun navigasi blog yang baik.

Widget navigasi konten blog seperti ini dianjurkan Google dan bisa menaikkan PageViews.

CB sendiri memasang Komentar Terbaru di Sidebar dan Most Commented Post di Footer Widget. Kodenya CB share di bawah ini.

Cara Memasang Widget Posting Terbanyak Dikomentari

1. Layout > Add a Gadget > HTML/JavaScript
2. Isi judul widget dengan, misalnya, "Paling Banyak Dikomentari"
3. Copas kode berikut ini ke kolom "Content":

<script type="text/javascript">
function getYpipePP(feed) {
 document.write('<ul style="">');
 var i;
 for (i = 0; i < feed.count ; i++)
 {
var href = "'" + feed.value.items[i].link + "'";
var pTitle = feed.value.items[i].title;
var pComment = " \(" + feed.value.items[i].commentcount + "\)";
var pList = "<li>" + "<a href="+ href + '" target="_blank">' + pTitle;
 document.write(pList);
 document.write(pComment); //to remove comment count delete this line
 document.write('</a></li>');
 }
 document.write('</ul>');
 }
 </script>
 <script src="http://pipes.yahoo.com/pipes/pipe.run?
 YourBlogUrl=http://contohblognih.blogspot.com/
 &ShowHowMany=5
 &_id=390e906036f48772b2ed4b5d837af4cd
 &_callback=getYpipePP
 &_render=json"
type="text/javascript"></script>

4. Ganti alamat blognya dengan blog Anda!
5. Save!

Kini widget "Posting Paling Banyak Dikomentari" sudah muncul di blog Anda.

Cara Memasang Widget Komentar Terbaru

1. Layout > Add a Gadget > HTML/JavaScript
2. Isi judul widget dengan, misalnya, "Komentar Terbaru"
3. Copas kode berikut ini ke kolom "Content":

<script style=text/javascript>
function showrecentcomments(json){for(var i=0;i<a_rc;i++){var b_rc=json.feed.entry[i];var c_rc;if(i==json.feed.entry.length)break;for(var k=0;k<b_rc.link.length;k++){if(b_rc.link[k].rel=='alternate'){c_rc=b_rc.link[k].href;break;}}c_rc=c_rc.replace("#","#");var d_rc=c_rc.split("#");d_rc=d_rc[0];var e_rc=d_rc.split("/");e_rc=e_rc[5];e_rc=e_rc.split(".html");e_rc=e_rc[0];var f_rc=e_rc.replace(/-/g," ");f_rc=f_rc.link(d_rc);var g_rc=b_rc.published.$t;var h_rc=g_rc.substring(0,4);var i_rc=g_rc.substring(5,7);var j_rc=g_rc.substring(8,10);var k_rc=new Array();k_rc[1]="Jan";k_rc[2]="Feb";k_rc[3]="Mar";k_rc[4]="Apr";k_rc[5]="May";k_rc[6]="Jun";k_rc[7]="Jul";k_rc[8]="Aug";k_rc[9]="Sep";k_rc[10]="Oct";k_rc[11]="Nov";k_rc[12]="Dec";if("content" in b_rc){var l_rc=b_rc.content.$t;}else if("summary" in b_rc){var l_rc=b_rc.summary.$t;}else var l_rc="";var re=/<\S[^>]*>/g;l_rc=l_rc.replace(re,"");document.write('<div class="rcw-comments">');if(m_rc==true)document.write('On '+k_rc[parseInt(i_rc,10)]+' '+j_rc+' ');document.write('<span class="author-rc"><a href="'+c_rc+'">'+b_rc.author[0].name.$t+'</a></span> commented');if(n_rc==true)document.write(' on '+f_rc);
if(o_rc==0){
document.write('</div>');
           }
else{
document.write(': ');if(l_rc.length<o_rc){document.write('<i>&#8220;');document.write(l_rc);document.write('&#8221;</i></div>');}else{document.write('<i>&#8220;');l_rc=l_rc.substring(0,o_rc);var p_rc=l_rc.lastIndexOf(" ");l_rc=l_rc.substring(0,p_rc);document.write(l_rc+'&hellip;&#8221;</i></div>');document.write('');}
    }
}
}
</script>
<script style=text/javascript>
    var a_rc = 7;
    var m_rc = false;
    var n_rc = true;
    var o_rc = 100;
</script>
<script src=http://contohblognih.blogspot.com/feeds/comments/default?alt=json-in-script&callback=showrecentcomments></script>
<style type="text/css">
.rcw-comments a {
    text-transform: capitalize;
}
.rcw-comments {
    border-bottom: 1px dotted;
    padding-top: 7px!important;
    padding-bottom: 7px!important;
}
</style>

4. Ganti alamat blognya dengan blog Anda!
5. Save!

Kini widget "Komentar Terbaru" sudah muncul di blog Anda. Good Luck! (http://contohblognih.blogspot.com).*

Sumber Kode: MBT & Help Blogger

Previous
« Prev Post
Author Image

CB Blogger

Recommended Posts

Related Posts

Show comments
Hide comments

1 comment on Kode Widget Komentar Terbaru & Posting Paling Banyak Dikomentari

Contact Form

Name

Email *

Message *