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

Stephen Bannasch stephen at deanbrook.org
Fri Mar 31 08:01:39 EST 2006

>Stephen Bannasch <stephen at deanbrook.org> writes:
>> 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
> > Typo.
>The magic's all in config/routes.rb
>Notice that we add the .xml extension there.

Hi Piers,

I see it now. These lines match feed urls with ".xml" at the end and route off to the feed action in XmlController.

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

That's one half of the answer -- the other half I'm still confused by.

How do the original displayed feed urls in components/plugins/sidebars/xml/content.rhtml get rendered with the ".xml" suffix?

> > The Sidebar 'Articles' feed is generated here:
> > components/plugins/sidebars/xml/content.rhtml
>> 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:
>> http://localhost:3000/xml/rss20/feed.xml

Thanks for your help.


-- Stephen Bannasch, stephen at deanbrook dot org

More information about the Typo-list mailing list