Hiển thị các bài viết theo nhãn cho Blogger (Blogspot)

Để xuất hiện các bài viết cùng một nhãn cho blogger/blogspot bạn dùng đoạn javascript sau:


<!-- Recent Posts by Label Start -->
 <script type="text/javascript">
 function recentpostslist(json) {
 document.write('<ul>');
 for (var i = 0; i < json.feed.entry.length; i++)
 {
 for (var j = 0; j < json.feed.entry.link.length; j++) {
 if (json.feed.entry.link[j].rel == 'alternate') {
 break;
 }
 }
 var entryUrl = "'" + json.feed.entry.link[j].href + "'";//bs
 var entryTitle = json.feed.entry.title.$t;
 var item = "<li>" + "<a href="+ entryUrl + '">' + entryTitle + "</a> </li>";
 document.write(item);
 }
 document.write('</ul>');
 }
 </script>
 <script src="http://blogluutrukienthuc.blogspot.com/feeds/posts/summary/-/MyLabel?max-results=8&alt=json-in-script&callback=recentpostslist"></script>
 <!-- Recent Posts by Label End -->


Chú ý:


Thay "MyLabel" Thành nhãn mà bạn muốn hiển thị.


Thay url blog thành blog của bạn.


Bạn có thể dán code vào tiện ích HTML/Javascript của Blogger - Blogspot.


Chúc các bạn thành công!