Migrating Typo Feeds to FeedBurner using Mongrel
Daminen Tanner has a nice article on migrating your Typo feeds to FeedBurner. However, his implementation for redirecting the feeds does not work for my setup since I am using Mongrel. I could not seem to find a documented solution so I came up with one myself. The solution I came up with will also work with any deployment since I modified the Typo code to perform the redirects rather than configuring the server to do so.
I wanted to make sure that I did not change any of the Typo feed URLs. I want to keep ownership of these in case sometime in the future I decide not to use FeedBurner. If I directly gave out the FeedBurner URL than it would be extremely difficult to seamlessly migrate to another service in the future.
On another note, I found a blog written by the FeedBurner folks that states:
Notice that we use a temp redirect. If we used permanent instead, readers would forget the old URL and just use the new URL permanently. In our pre-alpha service phase, we donââ¬â¢t yet recommend permanent redirection.
I donââ¬â¢t think that FeedBurner is still in a pre-alpha phase, but once again, I donââ¬â¢t want a reader to forget the old URL. I want readers to continue to using the URL I am in control of so, one day in the future, I can using another service or no service at all. Therefore, I decided to use a temp redirect rather than a permanent redirect.
Enough rambling. Here are the details. The line numbers and code here is based on Typo 4.0.3. In the file app/controllers/xml_controller.rb, line 42, replace the following line:
render :action => "#{@format}_feed"
with
# Want to redirect to FeedBurner unless FeedBurner is the user-agent. if @request.user_agent =~ /FeedBurner/ || @format == 'googlesitemap' render :action => "#{@format}_feed" else redirect_to "http://feeds.feedburner.com/JotThought" end
Donââ¬â¢t forget to replace my FeedBurner URL with your own.
Then, at the top of this file youââ¬â¢ll need to disable caching of the feed. This is necessary because after the feed is cached it will no longer redirect correctly. I am going to look into this more to find a better solution. This will work for me in the meantime.
class XmlController < ContentController caches_action_with_params :feed session :off ...
with
class XmlController < ContentController #caches_action_with_params :feed session :off ...
Thatââ¬â¢s it. All that is left to do is clear the Typo cache and restart Mongrel.
While doing this, I was thinking that I should just create a patch for Typo with a full solution. It would be very simple to add an option in the admin pages that allow anyone to specify their FeedBurner URL. I would then make the code above conditional and grab the FeedBurner URL from the Blog model object. If I have time over the next couple of days, I will create a patch and post the details here.
Trackbacks
Use this link to trackback from your own site.
Thanks for the writeup, I’m going to try it now. Did you switch to WordPress after writing this? I notice your not using Typo anymore. How did you convert your articles over to WordPress?
We switch to WordPress from Typo shortly after this posting. We liked the features of Typo but we were having some major issues with Spam and Typo wasn’t integrated with Akismet at the time while WordPress was. It is amazing how well that service blocks Spam.
We only had a couple articles to move over so it wasn’t much of an issue. I simply copied the raw content of the 3 - 4 postings and moved them to WordPress. I then added some redirects to apache to make sure the old urls didn’t break.
Hey thanks just used this on our site http://www.offtheback.co.nz - worked like a charm!