List recent Posts by Label

Do you want learn how to  list all or your most recent posts according to categories or by labels? Well then, you’ve come to the right tutorial.I have seen people use a LinkList gadget to accomplish this.  and struggling how to list their Recent Post by label. you came to right place to learn. However this method requires them to MANUALLY add each post link to the gadget every time they publish a post with the specified label.

List recent Posts by Label

Step 1: Login to your Blogger account.
Step 2: Go to Design > Page Elements > Click Add A Gadget

Step 3: In Add A Gadget window, select HTML/Javascript
Step 4: Enter a label as the title of your widget.
<!-- 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[i].link.length; j++) {

if (json.feed.entry[i].link[j].rel == 'alternate') {

break;

}

}

var entryUrl = "'" + json.feed.entry[i].link[j].href + "'";//bs
var entryTitle = json.feed.entry[i].title.$t;
var item = "<li>" + "<a href="+ entryUrl + '">' + entryTitle + "</a> </li>";

document.write(item);
}

document.write('</ul>');
}
</script>
<script src="http://blog.kentemplates.com/feeds/posts/summary/-/Blogger Tutorial?max-results=5&alt=json-in-script&callback=recentpostslist"></script>
<!-- Recent Posts by Label End -->
Blogger Tutorial: Labels name
http://blog.kentemplates.com: Change to your domain
Step 5: Click Save.

Post a Comment

Previous Post Next Post