fix post ordering
This commit is contained in:
parent
981048098a
commit
d233cb0dca
@ -11,7 +11,7 @@ $blockquote-border: $dove-grey !default
|
|||||||
body
|
body
|
||||||
margin: 0
|
margin: 0
|
||||||
padding: 0
|
padding: 0
|
||||||
background: $body-background url("../images/bkg.png") 0 0
|
background: $body-background url("bkg.png") 0 0
|
||||||
color: $body-foreground
|
color: $body-foreground
|
||||||
font-size: 16px
|
font-size: 16px
|
||||||
line-height: 1.5
|
line-height: 1.5
|
||||||
@ -136,7 +136,7 @@ dt
|
|||||||
|
|
||||||
|
|
||||||
ul li
|
ul li
|
||||||
list-style-image: url('../images/bullet.png')
|
list-style-image: url('bullet.png')
|
||||||
|
|
||||||
|
|
||||||
blockquote
|
blockquote
|
||||||
|
@ -40,12 +40,16 @@ class Post
|
|||||||
end
|
end
|
||||||
def self.posts
|
def self.posts
|
||||||
return @@posts if @@posts
|
return @@posts if @@posts
|
||||||
@@posts ={}
|
posts ={}
|
||||||
Dir["#{self.blog_path}/_2*.haml"].reverse.each do |file|
|
Dir["#{self.blog_path}/_2*.haml"].reverse.each do |file|
|
||||||
post = Post.new(file)
|
post = Post.new(file)
|
||||||
@@posts[post.slug] = post
|
posts[post.slug] = post
|
||||||
end
|
end
|
||||||
@@posts
|
@@posts = posts.sort_by { |slug, post| post.sort_key }.reverse.to_h
|
||||||
|
end
|
||||||
|
|
||||||
|
def sort_key
|
||||||
|
year*10000 + month*1000 + day
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.blog_path
|
def self.blog_path
|
||||||
|
@ -13,4 +13,4 @@
|
|||||||
.center_col
|
.center_col
|
||||||
%h1= @post.title
|
%h1= @post.title
|
||||||
.center_col
|
.center_col
|
||||||
= render( @post.template_name )
|
= render( "posts/#{@post.template_name}" )
|
||||||
|
Loading…
Reference in New Issue
Block a user