added the atom feed
This commit is contained in:
parent
b06381fdfc
commit
f618c927a5
5
page.rb
5
page.rb
|
@ -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
16
views/atom.haml
Normal 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)
|
Loading…
Reference in New Issue
Block a user