Convert Blog Posts into List View using JS

Convert Blog Posts into List View using JS ~ theAShub Store
 Convert Blog Posts into List View using JS

You have seen such blogs where all the post were displayed in categories and new post will also get attached in them. In this way we can save time with proper management of posts. So if you’re thinking of a category blog in which all blog post automatically displayed in respected categories then you are on the right blog post. Here we show how to implement it into blog using JS code.

◘ Why we convert blog posts into list view ? 
We use it for better post managements into categories view. As once it implement into blog it automatically manage all the blog post of a label into their respected type. In this way blog look beautiful and easy to navigate and good for exploration.

◘ How can we convert blog posts into list view ?

  • Open Blogger Dashboard
  • Choose a place where you want to add this code
  • Copy below code
  • Add Html/JS gadget
  • Paste the copied code in it
  • All set, now you can check the result
<script type="text/javascript">
function recentpostslist(json) {
 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') {
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>";
<script src=";alt=json-in-script&amp;callback=recentpostslist"></script>
◘ Understanding codes structure
<script src=”;alt=json-in-script&amp;callback=recentpostslist”></script>

• Replace blog url with your own. Blogger is label of post which is convert into list. Change it with your needful label name.

<script src=”;alt=json-in-script&amp;callback=recentpostslist”></script>

• max-results=10 is the number of blog post which shows in list view change it as per need.

◘ Benefits of blog posts into list view ?

If you want to make category blog like appstore, shopping, downloading, etc in these blogs there are many categories are found. So you need to separate all the related blog posts into their respected category. If you’re using above method just paste it once and implement as you want and later on it automatically includes all the new posts into respected categories. In this way you can save your time and attracts user on your site.

* It will only change posts of a label into list view. For multiple list of multiple labels, you can add the same code with different labels.

Thanks for being here, stay connect with us.

Leave a Comment