Smart Recent Blog Post List

Sep 18, 2011

List of Blog Post Gadget for blogger using javascript

Blogger Data API Sample

Following post will help in retrieving the information related to list of post from a blog. One can use this to display the list of blogs by following easy step mentioned below

 1) Add one html/javascript gadget to your blog.

2) Copy paste below code to your gadget.

3) Replace feeduri with your blog feed uri.

           var feedUri = '';

 4) just save the gadget and its ready to use. Here goes the code for list of post for a blog :-


* Retrieve a list of blog posts

// Obtain a reference to the 'content' div
var content = document.getElementById('content');

// Create the blogger service object
var bloggerService =
    new google.gdata.blogger.BloggerService('com.appspot.interactivesampler');

// The feed for a single blog. (In this case, the Official Google Blog.)
// The ID included in this URI can be retrieved from the
// <link rel=""> element in the Blog's HTML source
var feedUri = '';

// A callback method invoked getBlogPostFeed() returns data
var handleBlogPostFeed = function(postsFeedRoot) {
  var posts = postsFeedRoot.feed.getEntries();
  // This variable will buffer HTML output until function completes
  var html = '';
  // Display blog's title
  html += '<dl>'
       + '<dt><strong>Blog:</strong> '
       + '<a href="'
       + postsFeedRoot.feed.getLink('alternate').getHref()
       + '">'
       + postsFeedRoot.feed.getTitle().getText()
       + '</a></dt>';
  // Display blog posts
  html += '<dd><ul>';
  for (var i = 0, post; post = posts[i]; i++) {
    var postTitle = post.getTitle().getText();
    var postURL = post.getHtmlLink().getHref();
    html += '<li><a href="' + postURL + '" target="_blank">'
              + postTitle
              + '</a></li>';
  html += '</ul></dd>';
  // Write out buffered HTML, and clear the "Loading..." message
  content.innerHTML = html;

var handleError = function(error) {
  content.innerHTML = '<pre>' + error + '</pre>';

bloggerService.getBlogPostFeed(feedUri, handleBlogPostFeed, handleError);



Below is the demo of above code for my blog :-





Blogspot post list javascript

i found your site through search, yours site is a nice and excellent website.. contents are nice.. will grow higher in future

tried it step by step and changed the blog url, not working though

what exactly you are getting as output, and specify error if you are getting any

Hi, i get this as output when i paste the code in the default HTML/Javascript widget

// Obtain a reference to the 'content' div var content = document.getElementById('content'); // Create the blogger service object var bloggerService = new google.gdata.blogger.BloggerService('com.appspot.interactivesampler'); // The feed for a single blog. (In this case, the Official Google Blog.) // // The ID included in this URI can be retrieved from the // element in the Blog's HTML source var feedUri = ''; // A callback method invoked getBlogPostFeed() returns data var handleBlogPostFeed = function(postsFeedRoot) { var posts = postsFeedRoot.feed.getEntries(); // This variable will buffer HTML output until function completes var html = ''; // Display blog's title html += '

' + '
Blog: ' + '' + postsFeedRoot.feed.getTitle().getText() + ''; // Display blog posts html += '

'; for (var i = 0, post; post = posts[i]; i++) { var postTitle = post.getTitle().getText(); var postURL = post.getHtmlLink().getHref(); html += '
' + postTitle + '
'; } html += '

'; // Write out buffered HTML, and clear the "Loading..." message content.innerHTML = html; }; var handleError = function(error) { content.innerHTML = '

' + error + '

'; }; bloggerService.getBlogPostFeed(feedUri, handleBlogPostFeed, handleError);

Good presentation, You give is very helpful and we thank you very much..

Thanks for your suggestions. It helped me to develop my site

Wish you all the best.

Very nice post.
Get more offer of online mobile recharge and DTH at cuponswall freecharge India.

Learning new technolgoy would help oneself at hard part of their career. And staying updated is the only way to survive in current position. Your content tells the same. Thanks for sharing this information in here. Keep blogging like this.

Best JAVA Training institute in Chennai | Best JAVA Training in Chennai | Hadoop training in chennai

Many website builders rely on JavaScript to make their websites functional. Functions such as drop down menus, image changes, and linking to other websites are all done through the JavaScript program.
See more at: javascript

Thanks for sharing this post.There are more job vacancies in IT sectors.JAVA is really useful for IT professionals.

Java courses in Chennai |
Best JAVA Training in chennai

Your content is nice and understandable.Keep sharing like this.
Hadoop course in Chennai |
Hadoop Training institutes in Chennai

The expansion of internet and other business intelligence leads to large volume of data. Industries are looking for talented professionals to maintain and process huge volume of data with latest tools available in the market. Taking Hadoop Training in Chennai | Big Data Training in Chennai will ensure better career prospects for talented professionals.

you have written a great article on gadget for blogger do check out some article in my blog gadjet geek

I have read your blog its very attractive and impressive. I like it your blog.
Java Training institute in velachery

Croma campus is best IT training institute and best class IT trainer provides croma campus is great JavaScript training in noida wiht jo b placement support. croma campus best facilities and lab provides then best option for you join us croma campus

This blog is very informative about the concepts involved in hadoop and its scope in future. Interesting concepts on its architectute and syllabus which are covered by big data hadoop training institute in Chennai that is functioning effectively.

Really a good technical site,keep on writing good stuffs
dot net training in chennai

Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging…
PHP Training Chennai|PHP Training Institute in Chennai

Great informational resource as always!I really love the way of explaining this post.You are just ouststanding..Keep posting more

White Label Website Builder

Online mba in India
DEIEDU is the best online Institute in the world with high class course outline and up to date learning materials. DEIEDU is providing the online mba in india, online mba in india, Distance learning mba courses in india, Correspondence mba in India Mba from distance in India, Online Executive Mba in India, distance Mba from India, Online distance mba in India. Distance learning mba degree in India.
401, fourth floor sg alpha tower
Vashundhra (up)
Phone: 9811210788
online mba in india

Amazing article! I was confused about PHP Training in Chennai , but now got a clear view of the definition. Appreciate your hard work!

I have an interest to learn Hadoop technology in online; the online tutorials help me a lot to understand the Big Data concepts well, In that your post provides useful information about Hadoop. Thanks for sharing…
Hadoop Training in Chennai | Big Data Training in ChennaiBig Data Training

Post a Comment

Smart Recent Blog Post List