Tuesday, August 25, 2015

Recent Post Gadget by Specific Label | Blogger Widget

Are you searching how to show all your recent specific label posts according to groups, categories, types or labels ? Well then, you’ve come to the right tutorial. I’ve seen people use a LinkList gadget to accomplish this. However this method requires them to individually or munally add each post link to the gadget every time they publish a post with the specified label. Not good. We’re not going to do that, because we have a better, more elegant solution. Once added, the list will update itself automatically after you publish your blog post. The widget takes your blog’s label-specific feed, in JSON format and turn it into a list using Javascript. It is fast loading and manual updating and rearranging.


Now, lets start to add amezing widget for your blog which allow you yo list your specific label post very easily:

1. Firstly copy this widget JavaSprit or HTML code :

<!-- Recent Posts by Label Start -->
<!-- code by www.umbg.com.np -->
<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 + '" target="_blank">' + entryTitle + "</a> </li>";
document.write(item);
}
document.write('</ul>');
}
</script>
<script src="http://www.YourBlogLink.Com/feeds/posts/summary/-/Your%20Label%20name?max-results=10&alt=json-in-script&callback=recentpostslist"></script>
<span style="font-size: 80%; float:right;">Get this <a href="http://www.umbg.com.np/2015/08/how-to-add-recent-post-by-label.html">Widget</a></span>
<!-- Recent Posts by Label End -->

2 . Go to Blogger Home » Layout » Add a Gadget » HTML/Javascript.

4. Enter label name as the title of your widget and past the code you coppied inside the content box.

6. Now modify the code as below :

- Change YourBlogLink.Com into your own blog adress (url). As for example if you were to list posts from My site you would have to replace it with http://www.umbg.com.np (without the trailing slash). Replace Your%20Label%20name to your own Label name. Change max-results=10 as you desire. For example if you were like to 50 post (only one labeld post) you have to change max-results=10 as max-results=50. Don't worry you can change it later accoroding to your need or desire. The titles are bulleted due the use of ordered list <ul> . If you want them numbered instead, just replace ul with ol.

7. Now Save your gadget.