Note to self: links in Atom feeds
There are two ways to refer to a resource in an Atom feed.
- If you are in a Person construct, use the
<uri/>element. - Everywhere else, use the Link construct’s
<link/>element.
So for example if you are using Rails’ atom_feed helper, author blocks should look like:
entry.author do |author|
author.name 'Andy Stewart'
author.uri 'http://airbladesoftware.com'
end
The helper will generate <link/> elements whenever you use the :url or :root_url options.
You can validate your Atom feeds with the Feed Validator. Your feed needs to be publicly available to use the web version of the validator. Alternatively you can run the validator locally if you have Python.
Andy Stewart, 21 March 2009
Posted in Notes To Self, Rails

0 Comments
Jump to comment form