Thursday, May 20, 2010

From feed to script

Blogger is stubborn about blog-post order. Last things first, on the theory that blog readers are not interested in what you said yesterday.

Fortunately, Blogger has been flexible about allowing bloggers to post their own scripts in the javascript language in their blogs.

What this means is that you can show your blog content as a journey, in first-first chronological order, if you are willing to jump through a few hoops: publish as a feed, squirt the feed through Pipes, and convert the feed of that to a script. is one of several web-based services that convert feeds to scripts that you can just paste onto a blog or other web page. The script will then display the feed. (Formatting is another matter.)

You will be using feed2js's "build" page. Take the feed url from the result of your pipe (with an "http:" at the beginning) and paste it into the "feed url" box on that page.

Then review the options for the feed.

These are largely personal choice, but here are some notes from my experience.

Show channel--I set this to "no" and provide my own title and introductory text on my blog page.

Number of items to display--In my experience, the "0" option does not always display all of the posts. I use "999" instead.

Show/Hide item descriptions? How much?--If you specify "0," your script will generate only a list of blog-post titles. That could be exactly what you want.

The other options--to show the first n letters of the post--won't work with my hack. You can limit what is shown using the first 250-odd characters through your feed settings back at Blogger, which you can change at any time.

Show item author?--set this to "no" if you are using the Full or Jump-Break feed.

Use HTML in item display?--If you are using my hack, this has to be set to "yes," unless you only want to show the titles of your blog posts--in which case you want "no."

The rest of the options are up to you. I check "UTF-8 Character Encoding" on principle, but haven't noticed any advantage in practice.

Note there is a "preview" button that gives you a rough idea of what you've done. When you are satisfied with that, click "generate javascript" and copy the resulting code--all of it--back to your blog on a static page (not a blog post).

If you are only making a simple list of your blog-post titles, the javascript version can make a nifty sidebar widget.

If your feed won't validate, the #1 reason is that your feed url begins with "feed://" and not "http://." If that's your problem, just make the change yourself.

Then take your script here.


  1. btw, it seems like it stopped retrieving data when it is older than 2011-04-13T15:27Z.

    I tried it on two of my blogs.


  2. This comment has been removed by the author.

  3. Rat, I am not able to duplicate the problem with my blog feeds. That is to say, it works for me.

    I wonder if you are not encountering one of the new stumbling-block limits that I describe briefly in my reply to your comment to this post. Workaround forthcoming, I hope.

    That's not so say there isn't a problem, and one that I happen to regret very much. I just mean it's a little different than the way you describe it.

    Sorry for the inconvenience!