diff options
author | djones <dgjones@gmail.com> | 2010-09-14 15:02:02 +1200 |
---|---|---|
committer | djones <dgjones@gmail.com> | 2010-09-14 15:02:02 +1200 |
commit | 4a5e2ec52e5b346858738990c05ab45812f9bf78 (patch) | |
tree | 172d2220e7f497d57316cf0936947cf99455d564 /app | |
parent | dcad55e29197ab2ccb610ce381da90e1c18d182c (diff) | |
download | refinerycms-blog-4a5e2ec52e5b346858738990c05ab45812f9bf78.tar.gz refinerycms-blog-4a5e2ec52e5b346858738990c05ab45812f9bf78.tar.bz2 refinerycms-blog-4a5e2ec52e5b346858738990c05ab45812f9bf78.zip |
add rss support
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/blog/posts_controller.rb | 12 | ||||
-rw-r--r-- | app/views/blog/posts/index.rss.builder | 17 |
2 files changed, 25 insertions, 4 deletions
diff --git a/app/controllers/blog/posts_controller.rb b/app/controllers/blog/posts_controller.rb index abb870d..a0340b7 100644 --- a/app/controllers/blog/posts_controller.rb +++ b/app/controllers/blog/posts_controller.rb @@ -2,12 +2,16 @@ class Blog::PostsController < BlogController before_filter :find_all_blog_posts before_filter :find_blog_post, :only => [:show, :comment] - + + def index + respond_to do |format| + format.html + format.rss + end + end + def show @blog_comment = BlogComment.new - - # you can use meta fields from your model instead (e.g. browser_title) - # by swapping @page for @blogs in the line below: present(@page) end diff --git a/app/views/blog/posts/index.rss.builder b/app/views/blog/posts/index.rss.builder new file mode 100644 index 0000000..d9ad0da --- /dev/null +++ b/app/views/blog/posts/index.rss.builder @@ -0,0 +1,17 @@ +xml.instruct! :xml, :version => "1.0" +xml.rss :version => "2.0" do + xml.channel do + xml.title RefinerySetting.find_or_set(:site_name, "Company Name") + xml.description RefinerySetting.find_or_set(:site_name, "Company Name") + " Blog Posts" + xml.link blog_root_url + + @blog_posts.each do |post| + xml.item do + xml.title post.title + xml.description post.body + xml.pubDate post.created_at.to_s(:rfc822) + xml.link blog_post_url(post) + end + end + end +end
\ No newline at end of file |