Code đăng bài viết Blogspot dạng List Recent Post & Random Post hiển thị ngẫu nhiên theo nhãn.

[ Goghepthanh.com : Quý khách...Cần Mua Thớt Gỗ, Ván Ghép Giá Tốt, Cần Tìm Xưởng Xẻ Sấy, Bán Nguyên Liệu Gỗ Tràm... Uy Tín, Chất Lượng... Gọi Ngay : 0968 970 650
Mời Quý Khách Ghé Thăm Công Ty - Rất Hân Hạnh Được Phục Vụ.
]

Hôm nay Gia Bảo Blog giới thiệu với các blogger viết bài quảng cáo kiếm tiền theo mô hình tiếp thị liên kết kiểu đăng bài viết dạng " danh sách bài viết gần đây ngẫu nhiên theo nhãn ". 

Kiểu ngẫu nhiên theo nhãn - bài viết gần đây recent Post - có hình Kiểu A.1 :

<script type="text/javascript"> function showlatestpostswiththumbs(t){document.write('<ul class="recent-posts-container">');for(var e=0;e<posts_no;e++){var r,n=t.feed.entry[e],i=n.title.$t;if(e==t.feed.entry.length)break;for(var o=0;o<n.link.length;o++){if("replies"==n.link[o].rel&&"text/html"==n.link[o].type)var l=n.link[o].title,m=n.link[o].href;if("alternate"==n.link[o].rel){r=n.link[o].href;break}}var u;try{u=n.media$thumbnail.url}catch(h){s=n.content.$t,a=s.indexOf("<img"),b=s.indexOf('src="',a),c=s.indexOf('"',b+5),d=s.substr(b+5,c-b-5),u=-1!=a&&-1!=b&&-1!=c&&""!=d?d:"https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitWsmRGEnj8HKsUtMDqvlMHTTqsMlUVubBNUeFbku_9UoyiyK0pEB2MR8Hl8QBtx0qWLAynEWFEsEo9SWtuyk8wJSp4NyIlElng45-m2SZVl6QCTVjAVnYw40VaCbnNu_b07Kz5NmfU6yr/s1600/no-thumb.png"}var p=n.published.$t,f=p.substring(0,4),g=p.substring(5,7),v=p.substring(8,10),w=new Array;if(w[1]="Jan",w[2]="Feb",w[3]="Mar",w[4]="Apr",w[5]="May",w[6]="Jun",w[7]="Jul",w[8]="Aug",w[9]="Sep",w[10]="Oct",w[11]="Nov",w[12]="Dec",document.write('<li class="recent-posts-list">'),1==showpoststhumbs&&document.write('<a href="'+r+'"><img class="recent-post-thumb" src="'+u+'"/></a>'),document.write('<div class="recent-post-title"><a href="'+r+'" target ="_top">'+i+"</a></div>"),"content"in n)var A=n.content.$t;else if("summary"in n)var A=n.summary.$t;else var A="";var k=/<\S[^>]*>/g;if(A=A.replace(k,""),1==post_summary)if(A.length<summary_chars)document.write(A);else{A=A.substring(0,summary_chars);var y=A.lastIndexOf(" ");A=A.substring(0,y),document.write(A+"...")}var _="",$=0;document.write('<br><div class="recent-posts-details">'),1==posts_date&&(_=_+w[parseInt(g,10)]+" "+v+" "+f,$=1),1==readmorelink&&(1==$&&(_+=" | "),_=_+'<a href="'+r+'" class="url" target ="_top">Read more</a>',$=1),1==showcommentslink&&(1==$&&(_+=" <br> "),"1 Comments"==l&&(l="1 Comment"),"0 Comments"==l&&(l="No Comments"),l='<a href="'+m+'" target ="_top">'+l+"</a>",_+=l,$=1),document.write(_),document.write("</div>"),document.write("</li>")}document.write("</ul>")} </script> <script type="text/javascript"> var posts_no = 5; var showpoststhumbs = true; var readmorelink = true; var showcommentslink = false; var posts_date = true; var post_summary = true; var summary_chars = 70; </script>
<script type="text/javascript">
    quotes2recentpostsStyle1 = new Array()
    quotes2recentpostsStyle1[0] = "Nhu Yếu Phẩm"
    quotes2recentpostsStyle1[1] = "Nhu Yếu Phẩm"
    quotes2recentpostsStyle1[2] = "Nhu Yếu Phẩm"
    randomquote2recentpostsStyle1 = Math.random() * (quotes2recentpostsStyle1.length)
    randomquote2recentpostsStyle1 = Math.floor(randomquote2recentpostsStyle1)
    var randLabel = quotes2recentpostsStyle1[randomquote2recentpostsStyle1];
document.write('<script src="'+"https://www.digitalnomad.vn/feeds/posts/default/-/"+randLabel+"?orderby=published&alt=json-in-script"+'&callback=showlatestpostswiththumbs"><\/script>')
</script> 
<a style="font-size: 9px; color: #CECECE; margin-top: 10px;" href=" " rel="nofollow"> </a>
<noscript>Your browser does not support JavaScript!</noscript>
<link href='http://fonts.googleapis.com/css?family=Ubuntu+Condensed' rel='stylesheet' type='text/css' />
<style type="text/css">
img.recent-post-thumb{width:100px;height:100px;float:right;margin:5px -5px 5px 5px;-webkit-border-radius:100%;-moz-border-radius:100%;border-radius:100%;padding:3px;background: #fff} ul.recent-posts-container {list-style-type: none; background: #fff;padding: 0px;font:12px 'Ubuntu Condensed', sans-serif;margin: 5px 0px 5px 0px;} ul.recent-posts-container li:nth-child(1n+0) {background: #ffffff width: 100%} ul.recent-posts-container li:nth-child(2n+0) {background: # #ffffff; width: 100%} ul.recent-posts-container li:nth-child(3n+0) {background: # ffffff; width: 100%;} ul.recent-posts-container li:nth-child(4n+0) {background: # #ffffff; width: 100%;} ul.recent-posts-container li:nth-child(5n+0) {background:#ffffff F; width: 100%;} ul.recent-posts-container li {padding:5px 10px;list-style-type: none; margin: 0 0 -5px; color: #777;} .recent-posts-container a { text-decoration:none; } .recent-posts-container a:hover { color: #222;} .post-date {color:#e0c0c6; font-size: 11px; } .recent-post-title a {font-size: 14px;color: #444; font-weight: bold;} .recent-post-title {padding: 6px 0px;} .recent-posts-details a{ color: #222;} .recent-posts-details {padding: 5px 0px 5px; }
</style>

Kiểu ngẫu nhiên theo nhãn - bài viết gần đây recent Post - dạng Text không có hình Kiểu B.1 :

<div class="recentpostarea">

<style type="text/css"> .recentpostarea {list-style-type: none;counter-reset: countposts;} .recentpostarea a {text-decoration: none; color: #000000;} .recentpostarea a:hover {color: #000;} .recentpostarea li:before {background: #000000;float: left;counter-increment: countposts;content: counter(countposts,decimal);z-index: 2;position:relative;font-size: 20px;font-weight: bold;color: #fff; padding: 0px 10px; margin: 15px 5px 0px -6px; border-radius: 100%;} li.r-p-title { padding: 5px 0px;} .r-p-title { font-family: "Avant Garde",Avantgarde,"Century Gothic",CenturyGothic,AppleGothic,sans-serif;} .r-p-title a {text-decoration: none;color: #444;font-weight: bold;font-size: 13px; padding: 2px;} .recent-post-date {padding: 5px 2px 5px 30px; font-size: 11px; color: #999; margin-bottom: 5px;} .r-p-summ { border-left: 1px solid #69B7E2; color: #777; padding: 0px 5px 0px 20px; margin-left: 11px; font-family: Garamond,Baskerville,"Baskerville Old Face","Hoefler Text","Times New Roman",serif; font-size: 15px;} </style>
<script type = "text/JavaScript"> function showrecentposts(json) {for (var i = 0; i < posts_number; i++) { var entry = json.feed.entry[i];var posttitle = entry.title.$t;var posturl;if (i == json.feed.entry.length) break; for (var k = 0; k < entry.link.length; k++) {if (entry.link[k].rel == 'alternate') {posturl = entry.link[k].href;break;}} posttitle = posttitle.link(posturl);var readmorelink = "... read more";readmorelink = readmorelink.link(posturl); var postdate = entry.published.$t;var showyear = postdate.substring(0,4);var showmonth = postdate.substring(5,7);var showday = postdate.substring(8,10);var monthnames = new Array(); monthnames[1] = "Jan";monthnames[2] = "Feb";monthnames[3] = "Mar";monthnames[4] = "Apr";monthnames[5] = "May";monthnames[6] = "Jun";monthnames[7] = "Jul";monthnames[8] = "Aug";monthnames[9] = "Sep";monthnames[10] = "Oct";monthnames[11] = "Nov";monthnames[12] = "Dec"; if ("content" in entry) {var postcontent = entry.content.$t;}else if ("summary" in entry) { var postcontent = entry.summary.$t;} else var postcontent = ""; var re = /<\S[^>]*>/g; postcontent = postcontent.replace(re, ""); document.write('<li class="r-p-title">');document.write(posttitle);document.write('</li><div class="r-p-summ">');if (post_summary == true) {if (postcontent.length < summary_chars) {document.write(postcontent);} else { postcontent = postcontent.substring(0, summary_chars);var quoteEnd = postcontent.lastIndexOf(" ");postcontent = postcontent.substring(0,quoteEnd);document.write(postcontent + ' ' + readmorelink);}} document.write('</div>'); if (posts_date == true) document.write('<div class="recent-post-date">' + monthnames[parseInt(showmonth,10)] + ' ' + showday + ' ' + showyear + '</div>'); }} </script>
<script> var posts_number = 9; var posts_date = true; var post_summary = true; var summary_chars = 80; </script>
<script type="text/javascript">
    quotes2recentpostsStyle2 = new Array()
    quotes2recentpostsStyle2[0] = "Nhu Yếu Phẩm"
    quotes2recentpostsStyle2[1] = "Nhu Yếu Phẩm"
    quotes2recentpostsStyle2[2] = "Nhu Yếu Phẩm"
    randomquote2recentpostsStyle2 = Math.random() * (quotes2recentpostsStyle2.length)
    randomquote2recentpostsStyle2 = Math.floor(randomquote2recentpostsStyle2)
    var randLabel = quotes2recentpostsStyle2[randomquote2recentpostsStyle2];
document.write('<script src="'+"https://www.digitalnomad.vn/feeds/posts/default/-/"+randLabel+"?orderby=published&amp;alt=json-in-script"+'&amp;callback=showrecentposts"><\/script>')
</script> 
<noscript>Your browser does not support JavaScript!</noscript>
</div>