How To Filter Posts By Label On The Home Page In Blogger Blog

Initially I struggled to create a widgets with a specific label. But, after sometimes I got to know how to filter posts by label in blogger blog. I wanted to share my experience with you, So that you people can use this for your blog.

The below Steps will help you to add specific label post to you blog.

Step 1: Log in to the blogger and click Layout tab

Step 2: Click Add a Gadget link.

Step 3: Click HTML/JavaScript link from the list(here you can write your own html,css,javascript code)

Step 4: blidly copy the below code and paste it to content area and give the title of your widget.

<style>
ul li {
display:block;
}
</style>

<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.earnviablog.com/feeds/posts/summary/-/Blogging?max-results=10&alt=json-in-script&callback=recentpostslist"></script>

Step 5: Save the widget. and refresh your page.

Now you can filtered posts from specific label.

If you have any doubt leave a comment here. Thank you.

All the best!!!

2 comments:

  1. nice sort of info you have provide thanks for sharing latest online updates and news

    ReplyDelete
  2. Hi, thanks for the code it worked but how do you make it appear in a picture form

    ReplyDelete