16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'app/controllers/simple_posts/posts_controller.rb', line 16
def atom
posts = @posts.blog_posts.reverse
feed = RSS::Maker.make("atom") do |f|
f.channel.title = SimplePosts.site_title
f.channel.author = SimplePosts.site_author
f.channel.about = SimplePosts::Engine.routes.url_helpers.posts_url
f.channel.updated = posts[0].date.to_time
posts.each do |post|
f.items.new_item do |e|
e.title = post.title
e.link = SimplePosts::Engine.routes.url_helpers.post_url(id: post.name)
e.id = SimplePosts::Engine.routes.url_helpers.post_url(id: post.id)
e.updated = post.date.to_time
e.pubDate = post.date.to_time
e.content.content = post.render
end
end
end
render text: feed, content_type: 'application/atom+xml'
end
|