February 14, 2007

Blogger feed corrector: Yahoo Pipes based hack

UPDATE: You can try this hack now. Yahoo has fixed the date issue. I thank all those who voted on my feedback.

As many of you know, Blogger feeds are ordered by updated date and not published date. This becomes an inconvenience when you edit your old posts because it results in the posts resurrecting in your feed. Recently, Yahoo released an amazing feed manipulation service called Pipes and Aditya came up with a nice idea that we can re-order the Blogger feeds by published date using Pipes. I thought I will build upon that and make it easier for everybody.

This hack is for those who don't use Feedburner and depend on the feed provided by Blogger itself (the links that appear at the bottom of your page as "Subscribe to:"). I have modified Aditya's pipe slightly so that it can work with any feed. By making a small change in your template, you can provide the link to your blog's re-ordered feed instead of Blogger's feed. If you want to try it, first goto the pipe's page and give your blog's feed URL. Check if the pipe re-orders your posts by published date instead of updated date.

If you are convinced about it, here's how to use it in your template. Find this includable in your template.

<b:includable id='feedLinksBody' var='links'>
<div class='feed-links'>
<data:feedLinksMsg/>
<b:loop values='data:links' var='f'>
<a class='feed-link' expr:href='data:f.url'
expr:type='data:f.mimeType'
target='_blank'><data:f.name/> (<data:f.feedType/>)</a>

</b:loop>
</div>
</b:includable>

Replace the line in red with this line.

<a class='feed-link' expr:href='"http://pipes.yahoo.com/pipes/KEflSli82xGIHxezIBeTaQ/run?feed=" + data:f.url + "&amp;_render=rss"' expr:type='data:f.mimeType' target='_blank'><data:f.name/> (RSS)</a>

If you save the template and check your blog, you will see that 'Subscribe to' link now points to the re-ordered feed. You could write a post asking your current subscribers to resubscribe to your new feed so that any updates to your old posts will not affect them.

Caveats:

1. As the new feed is created by the pipe, the resulting feed's title will be the name of the pipe which is "Blogger feed corrector". In your post, you could ask your subscribers to rename the feed in their feed readers. Or you could clone my pipe and rename the pipe itself.
2. Yahoo only provides the piped feed in RSS and JSON formats (Naturally, they are not a big fan of Atom format because Google is behind it). So, the re-ordered feed is only available in RSS format. This is not a problem because almost all feed readers work with RSS.

If you try this and find any other caveats, let me know.

13 comments:

Aditya said...

Doh! That's not good ... this explains a lot! :(

I hope they get this fixed quickly...

Deepak said...

The hacks started rolling already!!
Way to go! :)

I've voted for your suggestion. I myself didn't notice it before you mentioned, because I didn't experiment much.

Jigar Shah said...

Blogger has acknowledged this problem ? Its really annoying to see older post first even if we have just added a tag to it....

raghu said...

sweet!

Aditya said...

Have you seen this happen? Try and run your pipe or mine, and subscribe to the resultant feed.

Nothing shows up... weird!

Ramani said...

Aditya,

Just check the URL of the RSS feed. You will see an extra %25 at several places of our input feed url. Singpolyma has already reported this double escape problem. Please vote for his suggestion here.

http://suggestions.yahoo.com/detail/?prop=Pipes&fid=6251

Aditya said...

Ah, I see. Now, even with the escapes removed, no reader recognises posts as new.

Even if I convert the feed to RSS and then pipe it through Pipes.

And yet, when you see the output preview in the lower debugger area, every post has a pubDate with the date clearly visible.

I'm a little confused .... 8|

Ramani said...

Aditya,

The debugger area maybe just a memory dump of the pipe's output. When the I checked the final RSS feed, pubdate was definitely empty.

Ramani said...

I mean I did a view source of the final feed.

Sumesh said...

Ramani, I read that you had no hacks to work on. Could you tell us how to remove the link rel=nofollow tag from the outgoing links in comments section?

I want to use it along with comment moderation, so that deserving people get links to their blogs.

Hope you will help,
Sumesh

Thrass said...

Is it possible to do something similar with feedburner?

Ramani said...

Thrass,

I think it should be possible to use the pipe's feed as the input for feedburner feed. But I haven't tried it yet. Will let you know after trying.

lavocedelmuro said...

Hi, Ramani.
Thank you for this hack, it works fine, but I have a question for you:
The subscription link at the bottom of the page is ok, but the small subscription icon that appear in URL bar in some browser (Firefox for example) point to the Bloggers feed url.
Is there a way to solve this problem?
Thank you very much
Roberto