Hướng dẫn tạo bài viết cùng chuyên mục theo nhãn có ADS cho blogspot tuyệt đẹp
tháng 8 28, 2018
Add Comment
Các bước thực hiện:
Bước 1: Và Blog ⇒ Chủ đề ⇒ Chỉnh sữa HTMLBước 2: Tìm thẻ
</head>
và chèn trước nó đoạn code phía dưới<style type='text/css'>.Stats img{display:none!important;background-image:none}.Stats .counter-wrapper{float:left;width:98%;text-align:right;line-height:35px;color:#333;font-weight:700;font-size:16px;margin-left:0}.Stats .counter-wrapper:after,.counts{font-size:15px;font-weight:600;color:#333}.Stats .counter-wrapper:after{content:"float:left;text-align:left}.counts{display:inline-block;width:98%;line-height:35px}.counts .count{display:inline-block;font-size:16px;height:30px;vertical-align:top;direction:ltr;float:right;color:#333;font-weight:700!important}.counts:hover .titles:before{color:#333!important;border-radius:2px;border-color:rgba(255,255,255,.1)}.counter-wrapper.text-counter-wrapper:before,.counts:before{font-family:FontAwesome;font-style:normal;font-weight:400;float:left;text-align:center;display:block;background-color:#fff;color:#333;width:35px;height:35px;font-size:18px;line-height:35px;border-radius:2px;margin:0 8px 0 0}.counter-wrapper.text-counter-wrapper:before,.counts.comment:before,.counts.post2:before{content:"\f0e6"}#Stats1_content{width:auto;height:auto;background-color:#fff}</style>Bước 3: Chèn đoạn code bên dưới vào nơi mà bạn muốn hiển thị "Bài viết liên quan" (Thường là cuối bài viết hay ở trên khung comment)
<b:if cond='data:blog.pageType == "item"'>
<style type='text/css'>
.block-title { border-bottom:1px solid #c5c5c5; position:relative; top:-30px; margin:0 }
.block-title h5 { font-family:"Roboto",sans-serif; font-size:22px; font-weight:500; line-height:60px; color:#555; text-align:left; margin:0 }
.block-title h5 span { display:inline-block; *display:inline; zoom:1; position:relative; top:30px; padding:0 10px 0 0 }
.bg-white { background-color:#fff !important }
#entry-header { margin:10px 0 0 0; padding:10px 0 0 0; border-top:1px solid #eee; border-bottom:0; border-radius:9px 9px 0 0 }
#related-posts { float:left; width:100%; margin:0; background:#fff; border-radius:9px 9px 0 0 }
#related-posts a { margin:5px; padding:0; position:relative; height:127px; width:32% }
#related-posts .related_img { object-fit:cover; width:100%; margin:0; height:127px; border-radius:0; padding:0}
#related-title { color:rgba(255,255,255,.85); text-align:center; padding:10px; margin:0; font-size:16px; box-sizing:border-box; font-weight:400; line-height:1.4; width:100%; transition:all .2s; position:absolute; letter-spacing:-.3px; bottom:0; background:rgba(0,0,0,0.72); text-overflow:ellipsis; white-space:nowrap; overflow:hidden }
#related-posts a:hover #related-title { color:#fff
#related-posts h5{position:relative;color:#00a06b;font-size:14px;font-weight:500;text-transform:uppercase;margin:10px 0;padding:0 0 5px;border-bottom:1px solid #eee}
#related-post h5{position:relative;color:#00a06b;font-size:14px;font-weight:500;text-transform:uppercase;margin:10px 0 0 0;padding:0 0 5px;border-bottom:1px solid #eee}
#related-posts h5:after,#related-post h5:after{content:'';position:absolute;left:0;bottom:-1px;background-color:#00a06a;width:24%;height:1px;display:block;z-index:2}
#related-post h5:after{width:20%!important}
.sidebar { color:#666; line-height:1.3em; border-top:none; font:16px "Roboto",sans-serif }
.related-posts-more { position:absolute; width:100%; height:127px; background:#333 url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgnzRJAC3S1K3SmRSsBtgDBft_GeU68a2wZTLQVhwMUIU16y0jRZ6YttzjHoHK5l4sM1a_9sdDp6B2ledNL_Xlo1UYDH42UyIqKGEo7IHj4ozmM8sfmmgKWx6heoBwivTWZe7OJoqlq2YJg/s30/search_icon.png) no-repeat center center; opacity:0; transition:.35s; z-index:2 }
#related-posts a:hover .related-posts-more { opacity:.35 }
</style>
<script type='text/javascript'>//<![CDATA[
// nguyentinhblog.com
var relatedTitles=new Array();var relatedTitlesNum=0;var relatedUrls=new Array();var thumburl=new Array();function related_results_labels_thumbs(json){for(var i=0;i<json.feed.entry.length;i++){var entry=json.feed.entry[i];relatedTitles[relatedTitlesNum]=entry.title.$t;try{thumburl[relatedTitlesNum]=entry.gform_foot.url}catch(error){s=entry.content.$t;a=s.indexOf("<img");b=s.indexOf("src=\"",a);c=s.indexOf("\"",b+5);d=s.substr(b+5,c-b-5);if((a!=-1)&&(b!=-1)&&(c!=-1)&&(d!="")){thumburl[relatedTitlesNum]=d}else thumburl[relatedTitlesNum]='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTa4p2z4WlH5j6hIlRh6C0a3Ke0lHoK1SC12Z7vJxVncwNmD7rqFqC5mTwGYH4ypBJ7TIiVaFfOZpnKIPTI01kUGZTCtNx0F1i_uhj8j7uPYSbGnZgz1QN34K3ICu0GFmd9fjKhbj8MD1L/s1600/no-thumbnail.png'}
if(relatedTitles[relatedTitlesNum].length>35)relatedTitles[relatedTitlesNum]=relatedTitles[relatedTitlesNum].substring(0,100)+"";for(var k=0;k<entry.link.length;k++){if(entry.link[k].rel=='alternate'){relatedUrls[relatedTitlesNum]=entry.link[k].href;relatedTitlesNum++}}}}
function removeRelatedDuplicates_thumbs(){var tmp=new Array(0);var tmp2=new Array(0);var tmp3=new Array(0);for(var i=0;i<relatedUrls.length;i++){if(!contains_thumbs(tmp,relatedUrls[i])){tmp.length+=1;tmp[tmp.length-1]=relatedUrls[i];tmp2.length+=1;tmp3.length+=1;tmp2[tmp2.length-1]=relatedTitles[i];tmp3[tmp3.length-1]=thumburl[i]}}
relatedTitles=tmp2;relatedUrls=tmp;thumburl=tmp3}
function contains_thumbs(a,e){for(var j=0;j<a.length;j++)
if(a[j]==e)return!0;return!1}
function printRelatedLabels_thumbs(){for(var i=0;i<relatedUrls.length;i++){if((relatedUrls[i]==currentposturl)||(!(relatedTitles[i]))){relatedUrls.splice(i,1);relatedTitles.splice(i,1);thumburl.splice(i,1);i--}}
var r=Math.floor((relatedTitles.length-1)*Math.random());var i=0;if(relatedTitles.length>0);document.write('<div style="clear: both;"/>');while(i<relatedTitles.length&&i<20&&i<maxresults){document.write('<a style="text-decoration:none;float:left');if(i!=0)document.write('"');else document.write('"');document.write(' title="'+relatedTitles[r]+'" href="'+relatedUrls[r]+'"><span class="related-posts-more"></span><img class="related_img" src="'+thumburl[r]+'"/><div id="related-title">'+relatedTitles[r]+'</div></a>');if(r<relatedTitles.length-1){r++}else{r=0}
i++}
document.write('</div>');relatedUrls.splice(0,relatedUrls.length);thumburl.splice(0,thumburl.length);relatedTitles.splice(0,relatedTitles.length)}
//]]></script>
</b:if>
<b:if cond='data:blog.pageType == "item"'>Nếu các bạn muốn tăng số bài viết hiển thị thì chỉ cần thay
<!--Bài viết liên quan Nguyễn Tỉnh Blog -->
<div id='related-posts'>
<h5>BÀI VIẾT CÙNG CHUYÊN MỤC:</h5>
<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_thumbs&max-results=7"' type='text/javascript'/></b:loop>
<script type='text/javascript'>
var currentposturl="<data:post.url/>";
var maxresults=6;
var relatedpoststitle="Bài viết cùng chuyên mục:";
removeRelatedDuplicates_thumbs();
printRelatedLabels_thumbs();
</script>
</div><div class='clear'/>
</b:if>
var maxresults=6;
thành số bạn muốnChúc các bạn thành công!