Menambahkan Widget related post (artikel terkait) ke blog sangat bermanfaat bagi para blogger karena widget ini terbukti dapat meningkatkan pageview blog. Berikut Ilustrasi pada gambar dibawah.
Tutorial Blogger Lainya:
Tutorial Blogger Lainya:
- Cara Menambahkan Widget Wikipedia Diblog
- Cara Membuat form Komentar terbaru diblog
- Cara Membuat Blog Menjadi Lebih Menarik
Berikut Cara Membuat Related Post Bergambar
Login ke Blogger >> Template. Tekan Edit HTML >>. Cari ]]> </ b: skin> dan Copy kode dibawah ini tepat diatas, ]]> </ b: skin>
.related-post .post-thumbnail {
z-index: 1;
position: relative;
width: 98px;
height: 98px;
margin: 0;
display: block;
border-right: 1px solid #fff;
border-bottom: 1px solid #fff;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
-webkit-box-shadow: inset 2px 2px 5px #444;
-moz-box-shadow: inset 2px 2px 5px #444;
box-shadow: inset 2px 2px 5px #555;
}
.related-post {
float: left;
position: relative;
width: 98px;
height: 98px;
margin: 0 10px 10px 0;
background: #F6F6F6;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
.related-post .related-post-title {
display: none;
float: left;
background: #000;
color: #fff;
text-shadow: none;
font-weight: bold;
padding: 10px;
position: absolute;
top: -20px;
left: 40px;
z-index: 2;
width: 200px;
-webkit-box-shadow: 0 0 2px #444;
-moz-box-shadow: 0 0 2px #444;
box-shadow: 0 0 2px #444;
}
.related-post:hover .related-post-title {display: block;}
Dan Cari koding seperti dibawah ini
<div class='post-footer'>
<div class='post-footer-line post-footer-line-1'/>
<div class='post-footer-line post-footer-line-2'/>
<div class='post-footer-line post-footer-line-3'/>
</div>
</div>
Copy kode dibawah ini tepat setela kode diatas
<div id='related-posts'>
<b:if cond='data:blog.pageType == "item"'>
<script type='text/javascript'>//<![CDATA[
var ry='<h3>Related Posts</h3>';rn='<h3> No related post available</h3>';rcomment='comments';rdisable='disable comments';commentYN='no';
var dw='';titles=new Array();titlesNum=0;urls=new Array();timeR=new Array();thumb=new Array();commentsNum=new Array();comments=new Array();function related_results_labels(c){for(var b=0;b<c.feed.entry.length;b++){var d=c.feed.entry[b];titles[titlesNum]=d.title.$t;for(var a=0;a<d.link.length;a++){if('thr$total' in d){commentsNum[titlesNum]=d.thr$total.$t+' '+rcomment}else{commentsNum[titlesNum]=rdisable};if(d.link[a].rel=="alternate"){urls[titlesNum]=d.link[a].href;timeR[titlesNum]=d.published.$t;if('media$thumbnail' in d){thumb[titlesNum]=d.media$thumbnail.url}else{thumb[titlesNum]='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhoBywiD60FPlnOo70VhUjnH13KNHBLoFkJETuhoetfCRHvkL-g_khr7XbQtaQQ_Lexne6ddulKR4wg8RaHf8BBp9irNjG5xp1r3lYeSjVi-Kt-yPQVGOnAkc32Ka_TJysPiSX4qiMYZYxI/'};titlesNum++;break}}}}function removeRelatedDuplicates(){var b=new Array(0);c=new Array(0);e=new Array(0);f=new Array(0);g=new Array(0);for(var a=0;a<urls.length;a++){if(!contains(b,urls[a])){b.length+=1;b[b.length-1]=urls[a];c.length+=1;c[c.length-1]=titles[a];e.length+=1;e[e.length-1]=timeR[a];f.length+=1;f[f.length-1]=thumb[a];g.length+=1;g[g.length-1]=commentsNum[a]}}urls=b;titles=c;timeR=e;thumb=f;commentsNum=g}function contains(b,d){for(var c=0;c<b.length;c++){if(b[c]==d){return true}}return false}function printRelatedLabels(a){var y=a.indexOf('?m=0');if(y!=-1){a=a.replace(/\?m=0/g,'')}for(var b=0;b<urls.length;b++){if(urls[b]==a){urls.splice(b,1);titles.splice(b,1);timeR.splice(b,1);thumb.splice(b,1);commentsNum.splice(b,1)}}var c=Math.floor((titles.length-1)*Math.random());var b=0;if(titles.length==0){dw+=rn}else{dw+=ry;dw+='<div class="clear"/></div><ul>';while(b<titles.length&&b<20&&b<maxresults){if(y!=-1){urls[c]=urls[c]+'?m=0'}if(commentYN=='yes'){comments[c]=' - '+commentsNum[c]}else{comments[c]=''};dw+='<div class="related-post"><div class="related-post-title">'+titles[c]+'</div><a href="'+urls[c]+'" rel="nofollow"><img border="0" class="post-thumbnail" alt="'+titles[c]+'" src="'+thumb[c]+'"/></a></div></div>';if(c<titles.length-1){c++}else{c=0}b++}dw+='</ul>'};urls.splice(0,urls.length);titles.splice(0,titles.length);document.getElementById('related-posts').innerHTML=dw};
//]]></script>
<b:loop values='data:post.labels' var='label'>
<script expr:src='"/feeds/posts/default/-/" + data:label.name + "?alt=json-in-script&callback=related_results_labels"' type='text/javascript'/>
</b:loop>
<script type='text/javascript'>var maxresults=6;removeRelatedDuplicates();printRelatedLabels('<data:post.url/>');</script>
</b:if>
</div>
<div class='clear'/>
Related Post Cara kedua.
Cara dibawah ini cukup simple, hanya menggunakan cara satu langkah atau sekali kopi koding ke blog.
Berikut.
Login ke Blogger >> Template. Tekan Edit HTML >>.
Sorot semua kode dibawah,
<b:if cond='data:blog.pageType == "item"'>
<style type='text/css'>
.custom_images ul {display:inline; list-style:none}
.custom_images ul li {float:left; margin-right:1px}
#related-posts{ float: left; margin: 50px 0 0; width: 500px;}
#related-posts h2 {color: #444; font-family: Segoe UI,Arial; font-size: 30px; font-weight: normal; margin: 0; padding: 0 0 10px; text-align: left; text-transform: none;}
#related-posts h4 {font-size:1.4em; font-weight:normal}
#related-posts h5 {font-size:1.17em; font-weight:normal}
#related-posts h4, #related-posts h5 {margin: 0.3em 0px}
#related-posts ul{list-style-type: none; margin-left: -48px; width: 650px;}
#related-posts ul li{position:relative;float:left;border:0 none;margin:0px 20px 0px 10px;width:150px}
#related-posts ul li:hover{z-index:98}
#related-posts ul li:hover div{position:absolute;top:50px;center:10px;margin-left:0;width:200px}
#related-posts ul li img{background: #fff; width:150px; height:150px;}
#related-posts ul li div{position:absolute;z-index:99;margin-left:-999em}
#related-posts ul li .title{background:#f9f9f9;padding:5px 10px}
</style>
<div style='clear:both'/>
<div id='related-posts'>
<script type='text/javascript'>var ry='<h2>Related Posts</h2>';rn='<h2>None Realated Posts</h2>';rcomment='Comments';rdisable='No Comments';commentYN='yes';</script>
<script type='text/javascript'>
//<![CDATA[
var nothumb='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4LwXCMw9ihC_XLhDMhkIVVKjTYgRosNh06RMDsAI4CE0vPITDrnovwpMKk8xI48gKJlFozCG94tOMefaLzPUdIBizC4_eLeePphArDr3BEtehujfKDXgpnIuscS0xo9XKRVFgQzsj_s4/s200-c/last%2528gr%2529256.jpg';dw='';titles=new Array();titlesNum=0;urls=new Array();time=new Array();thumb=new Array();commentsNum=new Array();comments=new Array();function related_results_labels(c){for(var b=0;b<c.feed.entry.length;b++){var d=c.feed.entry[b];titles[titlesNum]=d.title.$t;for(var a=0;a<d.link.length;a++){if('thr$total' in d){commentsNum[titlesNum]=d.thr$total.$t+' '+rcomment}else{commentsNum[titlesNum]=rdisable};if(d.link[a].rel=="alternate"){urls[titlesNum]=d.link[a].href;time[titlesNum]=d.published.$t;if('media$thumbnail' in d){thumb[titlesNum]=d.media$thumbnail.url}else{thumb[titlesNum]=nothumb};titlesNum++;break}}}}function removeRelatedDuplicates(){var b=new Array(0);c=new Array(0);e=new Array(0);f=new Array(0);g=new Array(0);for(var a=0;a<urls.length;a++){if(!contains(b,urls[a])){b.length+=1;b[b.length-1]=urls[a];c.length+=1;c[c.length-1]=titles[a];e.length+=1;e[e.length-1]=time[a];f.length+=1;f[f.length-1]=thumb[a];g.length+=1;g[g.length-1]=commentsNum[a]}}urls=b;titles=c;time=e;thumb=f;commentsNum=g}function contains(b,d){for(var c=0;c<b.length;c++){if(b[c]==d){return true}}return false}function printRelatedLabels(a){var y=a.indexOf('?m=0');if(y!=-1){a=a.replace(/\?m=0/g,'')}for(var b=0;b<urls.length;b++){if(urls[b]==a){urls.splice(b,1);titles.splice(b,1);time.splice(b,1);thumb.splice(b,1);commentsNum.splice(b,1)}}var c=Math.floor((titles.length-1)*Math.random());var b=0;if(titles.length==0){dw+=rn}else{dw+=ry;dw+='<ul>';while(b<titles.length&&b<20&&b<maxresults){if(y!=-1){urls[c]=urls[c]+'?m=0'}if(commentYN=='yes'){comments[c]=' - '+commentsNum[c]}else{comments[c]=''};dw+='<li><a href="'+urls[c]+'" rel="nofollow"><img alt="'+titles[c]+'" src="'+thumb[c]+'"/></a><div class="title"><h4><a href="'+urls[c]+'" rel="nofollow">'+titles[c]+'</a></h4><h5>'+time[c].substring(8,10)+'/'+time[c].substring(5,7)+'/'+time[c].substring(0,4)+comments[c]+'</h5></div></li>';if(c<titles.length-1){c++}else{c=0}b++}dw+='</ul>'};urls.splice(0,urls.length);titles.splice(0,titles.length);document.getElementById('related-posts').innerHTML=dw};
//]]>
</script>
<b:loop values='data:post.labels' var='label'>
<b:if cond='data:label.name != "Guest Posts"'>
<b:if cond='data:label.name != "Feature"'>
<script expr:src='"/feeds/posts/default/-/" + data:label.name + "?alt=json-in-script&callback=related_results_labels"' type='text/javascript'/>
</b:if></b:if>
</b:loop>
<script type='text/javascript'>var maxresults=3;removeRelatedDuplicates();printRelatedLabels('<data:post.url/>');</script>
</div>
<div style='clear:both'/>
<script type='text/javascript'>
//<![CDATA[
function replaceText(){if(!document.getElementById){return;}
bodyText = document.getElementById("related-posts");
theText = bodyText.innerHTML;
theText = theText.replace(/s72-c/gi, "s200-c");
bodyText.innerHTML = theText;
}replaceText();
//]]>
</script>
</b:if>
dan Kopikan semua kode diatas pas dibawah kode :
<div class='post-footer-line post-footer-line-3'/>
</div>
Simpan.
Tutorial menarik lainya.
- Cara membuat forum diblogger
- Cara Membuat meta tag seo friendly
- Cara membuat form contact diblogger
http://danforblogg.blogspot.com/
makasi ya dah mampir (c)
padahal widget ini sudah sama seperti yang saya gunakan pada blog ini..
Padahal pengen banget pasang tu related post..
salam kenal dari
http://indriya-angga.blogspot.com
saya udah update yang baru..
makasih dah berkunjung
saya sudah coba, tapi tetap aja gk ada efek...
ini code related post blog saya (http://indexiapk.blogspot.com
#content .related_posts{margin-top:25px;padding:0 10px 0 0}#content .related_posts h3{color:#444;font-size:12px;background:#fafafa;display:block;font-family:Arial,sans-serif;color:#444;letter-spacing:-0.5px;padding:15px 0 7px 0;border-bottom:solid 1px #fafafa;margin-bottom:5px}#content .related_posts a{color:#444}#content .related_posts ul{padding:0}#content .related_posts ul li{list-style:none;padding:9px 5px 9px 14px;border-bottom:1px solid #eee;line-height:18px;background:url(http://2.bp.blogspot.com/-ipsIvfDpiDA/T4MMjQaiGAI/AAAAAAAAAPE/0Jo4k87vtPc/bullet.png) no-repeat 0 14px}
makasih untuk jawabannya
http://www.zaenalabidin.web.id/
http://goo.gl/4jDhC3