Home » » Put Recent Post Titles By Label

Put Recent Post Titles By Label

1.Go to the Layout
2.Click add a Gadget
3.In add a Gadget Window, Select HTML/JavaScript
4.Enter the label Title as your Gadget
5.Copy the below code and paste inside the content box

6. Click save
<!-- Recent Posts by Label Start -->
<!-- code by BloggerSentral.com -->
<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="YOUR_BLOG_URL/feeds/posts/summary/-/YOUR_LABEL?max-results=SHOW_HOW_MANY&alt=json-in-script&callback=recentpostslist"></script>
<span style="font-size: 80%; float:right;">Get this <a href="http://merogaurab.blogspot.com/search/label/Blog%20Tips">widget</a></span>
<!-- Recent Posts by Label End -->

7.Replace you YOUR_BLOG_URL in code line with red above your own blog URL. For example if you were to list posts from merogaurab.blogspot.com, you would have to replace it with. http://www.merogaurab.blogspot.com.


8.Replace  YOUR_LABEL. Make sure you get it right. 
9.Replace your value SHOW_HOW_MANY upto 500 post in same lable.
10.Above titles are bulleted due to the order list <ul> if you want them numbered you just replace ul with ol

ADDING SUBSEQUENT
You need to add HTML/JavaScript gadget for each label. repeat same steps above for each label, with a slight differences.

  • You don't have to copy whole code. just find the below code  
<script src="YOUR_BLOG_URL/feeds/posts/summary/-/YOUR_LABEL?max-results=SHOW_HOW_MANY&alt=json-in-script&callback=recentpostslist"></script>
<span style="font-size: 80%; float:right;">Get this <a href="http://merogaurab.blogspot.com/search/label/Blog%20Tips">widget</a></span>

  • Make sure your first list(which contains the full code)is positioned on the top of all over list.



Share this article :

0 comments:

Post a Comment

Recent Posts

पुराना पोस्टहरु

Nepali Date Convertor

 
Support : FOOT1 | FOOT2 | FOOT3 | FOOT4 | FOOT5 | FOOT6 | FOOT7
Copyright © 2011. Gaurab Shrestha | गौरब श्रेष्ठ - All Rights Reserved
Blog Design by Gaurab Shrestha Helped by Ram Sharan Shrestha
Proudly powered by BLOGGER