Album 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

bài viết liên quan có quảng cáo adsense
Chào các bạn, hôm nay mình sẽ hướng dẫn các bạn làm bài viết liên quan cùng chuyên mục tuyệt đẹp cho blogspot của mình

Các bước thực hiện:

Bước 1: Và Blog ⇒ Chủ đề ⇒ Chỉnh sữa HTML
Bướ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:&quot;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:&quot;\f0e6&quot;}#Stats1_content{width:auto;height:auto;background-color:#fff}</style>
<b:if cond='data:blog.pageType == &quot;item&quot;'>
<style type='text/css'>
.block-title { border-bottom:1px solid #c5c5c5; position:relative; top:-30px; margin:0 }
.block-title h5 { font-family:&quot;Roboto&quot;,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:&#39;&#39;;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 &quot;Roboto&quot;,sans-serif }
.related-posts-more { position:absolute; width:100%; height:127px; background:#333 url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgbMl0Djl5HECEpVk3eYwjYWjShkkprxOIT7hVwltnLsn9NXY8xKsxOx4Ldv_I6BzP_xjYQC6GI9CwRIvkn6aaNaw1oFYFmpT4KpI5b_31UDMqs6aeriZ_iZB0u-S8UtzbAn5rZLMr4ZjUq/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/AVvXsEjBEGtRAhjcJUUSrx7dMzu1W9SFWjIT-zQQKK-meTyu0IgWdKqa7XVfStgUCi1po4QsE_y9vefGU4nk5UF2gzbmo-JHNrwGn9r2N57Sk3V8yIRJQD8y9DW06Ed7qKREkbd-HxPcmROYs7mt/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ướ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 == &quot;item&quot;'>
<!--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='&quot;/feeds/posts/default/-/&quot; + data:label.name + &quot;?alt=json-in-script&amp;callback=related_results_labels_thumbs&amp;max-results=7&quot;' type='text/javascript'/></b:loop>
<script type='text/javascript'>
var currentposturl=&quot;<data:post.url/>&quot;;
var maxresults=6;
var relatedpoststitle=&quot;Bài viết cùng chuyên mục:&quot;;
removeRelatedDuplicates_thumbs();
printRelatedLabels_thumbs();
</script>
</div><div class='clear'/>
</b:if>
Nếu các bạn muốn tăng số bài viết hiển thị thì chỉ cần thay var maxresults=6; thành số bạn muốn
Chúc các bạn thành công!
Bạn, Nguyễn Văn Nghĩa và người khác

Thông báo
Blog mình đang trong quá trình chỉnh sửa và hoàn thiện template mới nên còn một số chức năng click vào nhưng chưa dùng được. Lưu ý những blog nào đã liên kết với bên mình vui lòng đọc bài này để cập nhật logo blog nhé.
ĐÃ HIỂU