auto_discovery_link_tag(type = :rss, url_options = {}, tag_options = {}) public

Returns a link tag that browsers and news readers can use to auto-detect a RSS or ATOM feed for this page. The type can either be :rss (default) or :atom and the options follow the url_for style of declaring a link target.


  auto_discovery_link_tag # =>
    <link rel="alternate" type="application/rss+xml" title="RSS" href="http://www.curenthost.com/controller/action" />
  auto_discovery_link_tag(:atom) # =>
    <link rel="alternate" type="application/atom+xml" title="ATOM" href="http://www.curenthost.com/controller/action" />
  auto_discovery_link_tag(:rss, {:action => "feed"}) # =>
    <link rel="alternate" type="application/rss+xml" title="RSS" href="http://www.curenthost.com/controller/feed" />
  auto_discovery_link_tag(:rss, {:action => "feed"}, {:title => "My RSS"}) # =>
    <link rel="alternate" type="application/rss+xml" title="My RSS" href="http://www.curenthost.com/controller/feed" />
Show source
Register or log in to add new notes.
September 21, 2008
1 thank


auto_discovery_link_tag :atom, movies_url(:format=>‘atom’), :title=>‘New movies’

to produce the feed:

respond_to do |wants|
  wants.atom {render :action=>'index',:layout=>false}
December 28, 2008
1 thank

i think that's a bit better resourceful approach...

Code example

auto_discovery_link_tag :atom, formatted_movies_url(:atom), :title=>'New movies'
December 9, 2016
0 thanks

dealing with semicolon

Use tag! method if you have semicolon, for example:

xml.tag!(“atom:link”, “href”=>“http://rubyplus.com/episodes.rss”, “rel”=>“self”, “type”=>“application/rss+xml”)