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.
The Adventure Begins
I officially resigned from my Senior Software Engineering position at Intuit earlier today. I have been thinking about using my talents to start a company for quite some time now. After attending RailsConf, I became very motivated and started to seriously consider my options. After a couple months of planning, some luck, and the stars lining up, I decided to make the plunge.
Here is an overview of my plans for the next six months:
1. Expand my software development consulting business, Esomnie. I started this company in 2001 when I was attending school and continued to service clients while I was working fulltime.
2. Use the revenue from Esomnie to fund some basic web applications that I would like to build.
3. Build enough residual income from these basic web applications to start focusing on some of my large project ideas.
My blog will service as a diary of my business activities over the next couple of months. I am hoping that by writing about my daily business and technical activities, I will be able to better reflect upon my business goals while providing the software development and entrepreneurial communities with insider look of a self-funded startup.