auto_discovery_link_tag
- 1.0.0 (0)
- 1.1.6 (0)
- 1.2.6 (23)
- 2.0.3 (38)
- 2.1.0 (0)
- 2.2.1 (0)
- 2.3.8 (0)
- 3.0.0 (0)
- 3.0.9 (-4)
- 3.1.0 (0)
- 3.2.1 (0)
- 3.2.8 (0)
- 3.2.13 (0)
- 4.0.2 (-2)
- 4.1.8 (0)
- 4.2.1 (0)
- 4.2.7 (0)
- 4.2.9 (0)
- 5.0.0.1 (0)
- 5.1.7 (0)
- 5.2.3 (15)
- 6.0.0 (0)
- 6.1.3.1 (0)
- 6.1.7.7 (0)
- 7.0.0 (0)
- 7.1.3.2 (0)
- 7.1.3.4 (0)
- 7.2.3 (0)
- 8.0.0 (0)
- 8.1.1 (0)
- What's this?
auto_discovery_link_tag(type = :rss, url_options = {}, tag_options = {})
public
Returns a link tag that browsers and feed readers can use to auto-detect an RSS, Atom, or JSON feed. The type can be :rss (default), :atom, or :json. Control the link options in url_for format using the url_options. You can modify the LINK tag itself in tag_options.
Options
-
:rel - Specify the relation of this link, defaults to “alternate”
-
:type - Override the auto-generated mime type
-
:title - Specify the title of the link, defaults to the type
Examples
auto_discovery_link_tag # => <link rel="alternate" type="application/rss+xml" title="RSS" href="http://www.currenthost.com/controller/action" /> auto_discovery_link_tag(:atom) # => <link rel="alternate" type="application/atom+xml" title="ATOM" href="http://www.currenthost.com/controller/action" /> auto_discovery_link_tag(:json) # => <link rel="alternate" type="application/json" title="JSON" href="http://www.currenthost.com/controller/action" /> auto_discovery_link_tag(:rss, {action: "feed"}) # => <link rel="alternate" type="application/rss+xml" title="RSS" href="http://www.currenthost.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.currenthost.com/controller/feed" /> auto_discovery_link_tag(:rss, {controller: "news", action: "feed"}) # => <link rel="alternate" type="application/rss+xml" title="RSS" href="http://www.currenthost.com/news/feed" /> auto_discovery_link_tag(:rss, "http://www.example.com/feed.rss", {title: "Example RSS"}) # => <link rel="alternate" type="application/rss+xml" title="Example RSS" href="http://www.example.com/feed.rss" />
resourceful
auto_discovery_link_tag :atom, movies_url(:format=>‘atom’), :title=>‘New movies’
to produce the feed:
respond_to do |wants| wants.html wants.atom {render :action=>'index',:layout=>false} end
i think that's a bit better resourceful approach...
Code example
auto_discovery_link_tag :atom, formatted_movies_url(:atom), :title=>'New movies'
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”)

