Cache the related posts most_recent_posts

/cc @mattr- is this safe to do, you think? it only happens at render
time...
This commit is contained in:
Parker Moore 2014-10-20 22:18:11 -07:00
parent 817f6cb658
commit 656e772388
1 changed files with 1 additions and 2 deletions

View File

@ -46,8 +46,7 @@ module Jekyll
end
def most_recent_posts
recent_posts = site.posts.reverse - [post]
recent_posts.first(10)
@most_recent_posts ||= (site.posts.reverse - [post]).first(10)
end
def display(output)