[typo] how does typo produce feed urls with ".xml" suffix?

Stephen Bannasch stephen at deanbrook.org
Thu Mar 30 23:56:21 EST 2006

I'm pretty new to Ruby and Rails and I like to be able to create urls 
with an extension suffix similar to how Typo does this for the feed 
urls. However I need a bit of help understanding how this works in 

The Sidebar 'Articles' feed is generated here:


with this script fragment:

<%= url_for :controller=>'xml', :action=>'feed', :format => 
@sb_config['format'], :type => 'trackbacks' %>

In my case @sb_config['format'] == 'rss20' and it produces urls in 
the following form:


config/route.rb processes this url with this map:

map.xml 'xml/rss', :controller => 'xml', :action => 'feed', :type => 
'feed', :format => 'rss'

So clicking on the link runs XmlController#feed in 
apps/controllers/xml_controller.rb. Which calls the renderer at 
views/xml/rss20_feed.rxml (and a partial) which actually generates 
the xml feed.

I've discovered that if I take out ':format => @sb_config['format']' 
from the url_for link the '.xml' suffix is no longer generated but 
I'm having trouble going further.

Thanks for any pointers. If you are interested I've posted a 
description of my actual problem below.

ps. I'm learning a great deal studying and playing with the Typo code. Thanks!


I have a builder template that renders a Java webstart jnlp file. 
Right now I am creating the the jnlp file links like this:

   link_to 'Run', :action => 'jnlp', :id => activity

Which creates links like this:


The action looks like this:

   def jnlp
     @headers["Content-Type"] = "application/x-java-jnlp-file"
     @headers["Cache-Control"] = "public"
     @activity = Activity.find(params[:id])
     render :layout => false

Which then calls the Builder view: jnlp.rxml

By setting the Content-Type in the http headers most browsers 
correctly interpret the file "1" as a jnlp file and if Java is 
installed start the webstart application. However FireFox (and 
Mozilla) on MacOS seems to require that the file actually be served 
with the ".jnlp" filename suffix.

So I'd like to instead create links like this:


The general question is: how can I concatenate a static filename 
suffix to a link?



-- Stephen Bannasch, stephen at deanbrook dot org

More information about the Typo-list mailing list