This commit is contained in:
Nicolas Bally 2012-08-07 15:57:57 +02:00
parent 0f54f71446
commit 6eef235bbe
3 changed files with 41 additions and 0 deletions

View File

@ -13,6 +13,21 @@ class Public::ArticlesController < ApplicationController
@title = "Articles du blog" @title = "Articles du blog"
end end
def feed
# this will be the name of the feed displayed on the feed reader
@title = "Blog de Nicolas Bally"
# the news items
@articles = Article.before(Date.today).recents
# this will be our Feed's update timestamp
@updated = @articles.first.updated_at unless @articles.empty?
end
def category def category

View File

@ -0,0 +1,22 @@
xml.instruct! :xml, :version => "1.0"
xml.rss :version => "2.0" do
xml.channel do
xml.title "Blog de Nicolas Bally"
xml.description ""
xml.link "http://blog.nicolasbally.com"
for article in @articles
xml.item do
xml.title article.title
xml.description simple_format(article.description)
xml.pubDate article.published_at.to_s(:rfc822)
xml.link article_url(:slug => article.slug)
xml.guid article_url(:slug => article.slug)
end
end
end
end

View File

@ -10,6 +10,10 @@ Crossey2::Application.routes.draw do
#blog #blog
match '/feed' => 'public/articles#feed', :as => :feed, :defaults => { :format => 'atom' }
match "blog/categorie/:slug.:f"=> "public/articles#category", :as => :category_public_article, :f => "html" match "blog/categorie/:slug.:f"=> "public/articles#category", :as => :category_public_article, :f => "html"