0
0

added the atom feed

This commit is contained in:
Gibheer 2011-08-09 22:18:34 +02:00
parent b06381fdfc
commit f618c927a5
2 changed files with 21 additions and 0 deletions

View File

@ -43,6 +43,11 @@ class Blog < Sinatra::Base
Post.get_released(params[:id]).acknowledged_comments.to_json
end
get '/atom.xml' do
@posts = Post.get_page(0)
haml :atom, :layout => false
end
get '/stylesheet.css' do
scss :stylesheet
end

16
views/atom.haml Normal file
View File

@ -0,0 +1,16 @@
!!! XML
%feed{:xmlns => 'http://www.w3.org/2005/Atom'}
%title="zero-knowledge"
%subtitle="scripting, programming and administrating"
%link{:href => '/'}
%link{:type => 'application/atom+xml', :rel => "self", :href => '/atom.xml'}
-@posts.each do |post|
%entry
%id="/post/#{post.id}"
%link{:type => 'text/html', :rel => "alternate", :href => "/post/#{post.id}"}
%title=post.title
%updated=post.written
%author
%name=post.account.username
%summary{:type => 'html'}=markup(post.content, post.markup).match(/.*?<\/p>/m)[0]
%content{:type => 'html'}=markup(post.content, post.markup)