Thứ Tư, 7 tháng 8, 2013

Auto-Readmore


Trước khi thực hiện thủ thuật này thì bạn nên sao lưu lại template gốc để đề phòng, sau đó vào phần chỉnh sửa HTML rồi chèn đoạn CSS sau phía trên ]]></b:skin>


.thumb,.no-thumb{float:left;margin-right:15px;width:164px;height:164px;overflow:hidden;position:related}
.no-thumb{display:block;background:url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhim0PnEjVYjSUCeP_4gsTd6ZCNkVNV3ZLN-rHKAn7evJTJF87MjxcJo-Jd-B0pp90_R2CcL_jxkxcaoAQl1-lP-4j6YpTvry1jOKpt0HwTYWmGLRH93kiI6JpzYA_VKBKcqkAgB6jgFPk/) 0 0 no-repeat;}
a.jump-link{font-weight:bold}

Còn đoạn script này thì chèn bên dưới ]]></b:skin>


<script type='text/javascript'>//<![CDATA[
var snippet=60; G="s164-p";
function H(b,a){return b.replace(/<.*?>/gi,"").split(/\s+/).slice(0,a-1).join(" ")} function rm(b){var b=document.getElementById(b),a="",a=b.getElementsByTagName("img");if(1<=a.length){C=a[0].src;B=C.split("/");D=B[2];if(-1!=D.indexOf("blogspot")||-1!=D.indexOf("googleusercontent")||-1!=D.indexOf("ggpht"))F=B[7],C=-1==F.indexOf(".")?C.replace(F,G):B[0]+"//"+B[2]+"/"+B[3]+"/"+B[4]+"/"+B[5]+"/"+B[6]+"/"+G+"/"+B[7];a='<div class="thumb"><img src="'+C+'" /></div>'}else a='<div class="no-thumb"></div>';b.innerHTML=a+H(b.innerHTML,snippet)+"..."};
//]]></script>


 Màu đỏ là kích thước của ảnh thumb, bạn có thể sửa lại nhưng nên để chúng có giá trị bằng nhau.
Màu xanh là url ảnh thumb mặc định khi bài đăng không chứa ảnh nào.
60 là số kí tự đoạn trích dẫn, có thể sửa lại.

Cuối cùng, chọn mở rộng tiện ích tìm đến <data:post.body/> sửa nó thành:


<b:if cond='data:blog.pageType == &quot;index&quot;'>
<span expr:id='&quot;p&quot; + data:post.id'><data:post.body/></span>
<script type='text/javascript'>rm(&quot;p<data:post.id/>&quot;)</script><b:else/><data:post.body/></b:if>
<b:if cond='data:post.hasJumpLink'>
<a class='jump-link' expr:href='data:post.url + &quot;#more&quot;'>Read More</a><b:else/>
<b:if cond='data:blog.pageType == &quot;index&quot;'>
<a class='jump-link' expr:href='data:post.url' rel='nofollow'>Read More</a>
</b:if>
</b:if>
<div class='clear'/>

Save template lại, vậy là gần như xong, nếu trong template của bạn có đoạn dưới đây thì xóa nó đi:

 <b:if cond='data:post.hasJumpLink'>
<div class='jump-link'>
<a expr:href='data:post.url + &quot;#more&quot;' expr:title='data:post.title'><data:post.jumpText/></a>
</div>
</b:if>

0 nhận xét:

Đăng nhận xét

bạn là người thứ bao nhiêu?

nghe nhạc trực tuyếnNấu món chay | học nấu ăn DJ - Ảnh đẹp | xalotinnhanh