Membuat Auto Readmore di Blog

watch_later Monday, 23 June 2014
comment 2 Comments
Pada Kesempatan kali ini saya akan memberikan tutorial cara membuat Auto Readmore di Blog. Berikut Caranya
Auto Readmor di Blog
1.Login ke akun Blogger Sobat
2.Kemudian Pilih Template>> Edit HTML
3.Setelah itu cari kode <head> lalu letakkan kode berikut tepat di atas kode <head>
<!-- Auto read more script -http://foryoudontcry.blogspot.com/- Start --> <script type='text/javascript'> var thumbnail_mode = &quot;yes&quot;; summary_noimg = 400; summary_img = 300; img_thumb_height = 130; img_thumb_width = 130; </script> <script type='text/javascript'> //<![CDATA[ function removeHtmlTag(strx,chop){ if(strx.indexOf("<")!=-1) { var s = strx.split("<"); for(var i=0;i<s.length;i++){ if(s[i].indexOf(">")!=-1){ s[i] = s[i].substring(s[i].indexOf(">")+1,s[i].length); } } strx = s.join(""); } chop = (chop < strx.length-1) ? chop : strx.length-2; while(strx.charAt(chop-1)!=' ' && strx.indexOf(' ',chop)!=-1) chop++; strx = strx.substring(0,chop-1); return strx+'...'; } function createSummaryAndThumb(pID){ var div = document.getElementById(pID); var imgtag = ""; var img = div.getElementsByTagName("img"); var summ = summary_noimg; if(thumbnail_mode == "yes") { if(img.length>=1) { imgtag = '<span style="float:left; padding:0px 10px 5px 0px;"><img src="'+img[0].src+'" width="'+img_thumb_width+'px" height="'+img_thumb_height+'px"/></span>'; summ = summary_img; } } var summary = imgtag + '<div>' + removeHtmlTag(div.innerHTML,summ) + '</div>'; div.innerHTML = summary; } //]]> </script> <!-- Auto read more script -http://foryoudontcry.blogspot.com/- End -->
4.Keterangan :
1.summary_noimg = 400; >>> jumlah karakter artikel tanpa disertai dengan gambar
2.summary_img = 300; >>> jumlah karakter artikel disertai dengan gambar
3.img_thumb_height = 130; >>> tinggi rendahnya gambar yang akan muncul
4.img_thumb_width = 130; >>> lebar gambar yang akan muncul

5.Cari kode <data:post.body/> dan letakkan kode dibawah ini tepat diatas <data:post.body/>
<!-- Auto read more -http://foryoudontcry.blogspot.com/- Start --> <b:if cond='data:blog.pageType == &quot;item&quot;'> <data:post.body/> <b:else/> <b:if cond='data:blog.pageType == &quot;static_page&quot;'> <data:post.body/> <b:else/> <div style='text-align:justify;' expr:id='&quot;summary&quot; + data:post.id'><data:post.body/></div> <script type='text/javascript'> createSummaryAndThumb(&quot;summary<data:post.id/>&quot;); </script> <a class='more' expr:href='data:post.url'>Baca Selengkapnya →</a> </b:if> </b:if> <!-- Auto read more -http://foryoudontcry.blogspot.com/- End -->
6.Jika Sudah Simpan Selesai.
avatar

wahh..
kalo pakek auto read more jadi rapi ya blog kita :)
makasih share nya

delete 30 June 2014 at 09:53
avatar
bb

Makasih atas infonya gan

delete 2 September 2014 at 17:25



sentiment_satisfied Emoticon