Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add rss feed

  • Loading branch information...
commit 75769a73a6dc96f604e2f18de8b057c566b9e876 1 parent e30fabe
@meuble authored
Showing with 37 additions and 0 deletions.
  1. +8 −0 app.rb
  2. +6 −0 views/layout.haml
  3. +23 −0 views/rss.haml
View
8 app.rb
@@ -22,6 +22,14 @@ def partial(page, options={})
haml :index
end
+get '/rss' do
+ @title = "This Time - Stéphane Akkaoui's photo blog"
+ @pictures = Picture.all
+
+ cache_control :public, :must_revalidate, :max_age => 60
+ haml(:rss, :format => :xhtml, :escape_html => false, :layout => false)
+end
+
get '/:id' do
@picture = Picture.find(params[:id])
@title = @picture.nil? ? "This Time - Stéphane Akkaoui's photo blog" : @picture.title
View
6 views/layout.haml
@@ -15,6 +15,12 @@
%title
= @title
+
+ %link{:rel => "alternate", :type => "application/rss+xml", :title => "This Time - RSS Feed", :href => "http://thistime.imeuble.info/rss"}
+
+ %meta{'http-equiv' => "content-type", :name => "keywords", :content => "PhotoBlog,This time, Stéphane Akkaoui, Akkaoui, meuble, imeuble"}
+ %meta{'http-equiv' => "content-type", :name => "description", :content => "This Time, Some photos taken at various place, at this time."}
+
%link{:rel => "stylesheet", :href => "/site.css", :type => "text/css", :media => "screen", :charset =>"utf-8"}
%script{:type => "text/javascript", :src => "/jquery.js"}
View
23 views/rss.haml
@@ -0,0 +1,23 @@
+!!! XML
+%rss{:version => "2.0", "xmlns:atom" => "http://www.w3.org/2005/Atom"}
+ %channel
+ %title
+ @title
+ %link http://thistime.imeuble.info
+ %description Some photos taken at various place, at this time.
+ <atom:link href="http://thistime.imeuble.info/rss" rel="self" type="application/rss+xml" />
+ - for picture in @pictures do
+ %item
+ %title
+ = picture.title
+ %link
+ = picture.url
+ %description
+ %img{:src => picture.source, :alt => picture.title, :title => picture.title}
+ - if picture.description
+ = picture.description
+ %p
+ By
+ = picture.author
+ \ -
+ = picture.date
Please sign in to comment.
Something went wrong with that request. Please try again.