flux rss
This commit is contained in:
parent
0f54f71446
commit
6eef235bbe
@ -14,6 +14,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
|
||||||
|
|
||||||
|
|
||||||
|
22
app/views/public/articles/feed.rss.builder
Normal file
22
app/views/public/articles/feed.rss.builder
Normal 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
|
||||||
|
|
@ -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"
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user