Skip to content

Instantly share code, notes, and snippets.

@eng
Created December 3, 2008 21:40
Show Gist options
  • Save eng/31711 to your computer and use it in GitHub Desktop.
Save eng/31711 to your computer and use it in GitHub Desktop.
xml.instruct!
xml.rss("version" => "2.0", "xmlns:dc" => "http://purl.org/dc/elements/1.1/") {
xml.channel {
xml.title("My Awesome Feed")
xml.link("http://example.com/")
xml.pubDate(CGI.rfc1123_date(@posts.first.published_at || Time.now)) if @posts.any?
xml.description("My Awesome Feed's Description") if @posts.any?
@posts.each do |post|
xml.item {
xml.title(post.title)
xml.link(post_url(post))
xml.description(post.description)
xml.pubDate(CGI.rfc1123_date(post.created_at)) if post.created_at
xml.guid(post_url(post))
xml.dc(:creator, post.user.name)
}
end
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment