Wednesday, December 7, 2011

Blog feed for more than 500 posts

The folks at Blogger, bless their hearts, erect several obstacles to creative use of your blog's feed.

Some of us use our feeds--our whole feeds, not just the most recent stuff--to make an index of our blogs, or to reverse the order so that it begins with the oldest post.

The default Blogger feeds, however, show only the most recent 25 posts. This is pretty easy to get around: you just append "max-results=999" to the feed url, which overrides the 25-post limit (replacing it with a a larger one). So the feed for this blog, breaking the 25-post barrier, is
http://too-clever-by-half.blogspot.com/feeds/posts/default?max-results=999
It turns out that Blogger has a second, more-serious limit of 500 posts per feed. Here's how that works, and how to work around it if your blog has more than 500 posts.

This limit has probably been in place for a while. I missed it because it is not documented and also because I do not have more than 500 posts on any of my blogs. (Yet.)

Fortunately, this limit is also flexible, in a way. All of your posts are in your feed. However, you can only see them in 500-post increments.

For instance, if the first 500 posts of your blog feed are here:
http://YOURBLOG.blogspot.com/feeds/posts/default?max-results=999
the second 500 posts are here:
http://YOURBLOG.blogspot.com/feeds/posts/default?max-results=999&start-index=501
The "start-index=501" parameter (after the ampersand, which you must add) says to start the 500 count at post no. 501. If you have 809 posts in your blog, this will yield the oldest 309 of them.

Note the "max-results=999" parameter is still needed to override the other default limit of 25 posts.

This is a lot like the recent decision of Yahoo Pipes to paginate its feeds, and the remedy is similar.

You must treat each 500-post increment as a separate feed, manipulate each as you see fit, and then paste the scripts for them serially into your blog to create the entire series. (Use a service like feed2js to create the script for you.) You can also merge the feeds at Yahoo Pipes, if that works for you.

By the way, there is a similar 500-post segmentation of any label feed, and a 200-comment segmentation of the comment feed. In both cases the "start-index=" parameter gives you access to your whole feed, in chunks.

This is a nuisance and if it pushes you to say its not worth the trouble I do not blame you. However, with this workaround it is possible to get at your whole feed, if you need it, Blogger's limits notwithstanding.

12 comments:

  1. Thanks for the info. on this one. I didn't know that these limits existed. Of course, I have just recently begun blogging, so these limits will probably not pose any issues for me in the near future. Nonetheless, helpful advice. Thank you!

    ReplyDelete
  2. Anthony, this need only concern you if you are using your blog feed. It does not affect how your blog displays or paginates on regular blog pages.

    ReplyDelete
  3. i've 525 posts working and the main page still displayed as usual which i set to 5 post in the main page, but then recently as i posted my 526 post it seems like my blog has been resetted or is it a bug?

    ReplyDelete
    Replies
    1. @'rina: Sorry, but I have no idea.

      However, I doubt it has anything at all to do with the 500-post pagination of your blog feed by Blogger, which is the subject of this post.

      Delete
  4. thank you, this saved me a lot of time

    ReplyDelete
  5. Update: Today (November 5, 2016), Blogger feed has a limit of 150 items per page.

    Posts: 1 - 150
    http://YOURBLOG.blogspot.com/feeds/posts/default?max-results=150&start-index=1

    Posts: 151 - 300
    http://YOURBLOG.blogspot.com/feeds/posts/default?max-results=150&start-index=151

    Posts: 301 - 450
    http://YOURBLOG.blogspot.com/feeds/posts/default?max-results=150&start-index=301

    This blog is really nice! Thank you, Adam!!!

    ReplyDelete
    Replies
    1. @Circuito: Yes, Blogger cut us back to 150 posts from 500! I think I may be on to a workaround that will still go up to 500; no promises though.

      Delete
  6. please help me. i have 197 posts but only show 153 posts. whenever i post the new one, the oldest post will disappear and so on. i follow your instruction, but still nothing happen.

    ReplyDelete
    Replies
    1. @anon: I am sorry the start-index parameter is not working for you! Please, please post more information, including a link to the blog, in the Blogger Help Forum. It is a much better place to solve problems!

      Delete
  7. This is quite useful post esp. the comment which gives the details of first 150 posts.

    ReplyDelete