mirror of
https://github.com/samsonjs/samhuri.net.git
synced 2026-04-18 12:45:52 +00:00
sort blog posts by new timestamp field
This commit is contained in:
parent
1f34bb28e5
commit
193dc5c5d9
1 changed files with 3 additions and 2 deletions
5
blog.rb
5
blog.rb
|
|
@ -108,16 +108,17 @@ class Blag
|
|||
end
|
||||
end
|
||||
post[:url] = @url + '/' + post[:filename]
|
||||
post[:timestamp] = post[:timestamp].to_i
|
||||
post[:content] = lines.join
|
||||
template = post[:link] ? link_rss_template : post_rss_template
|
||||
post[:rss_html] = Mustache.render(template, {:post => post})
|
||||
post[:body] = RDiscount.new(post[:content]).to_html
|
||||
post[:rfc822] = Time.parse(post[:date]).rfc822
|
||||
post[:rfc822] = Time.at(post[:timestamp]).rfc822
|
||||
post[:tags] = (post[:tags] || '').split(/\s*,\s*/).map(&:strip)
|
||||
# comments on by default
|
||||
post[:comments] = true if post[:comments].nil?
|
||||
post
|
||||
end
|
||||
end.sort { |a, b| b[:timestamp] <=> a[:timestamp] }
|
||||
end
|
||||
|
||||
def rss
|
||||
|
|
|
|||
Loading…
Reference in a new issue