From 656e772388b316501f68ec3819f0fab750bfce37 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Mon, 20 Oct 2014 22:18:11 -0700 Subject: [PATCH] Cache the related posts most_recent_posts /cc @mattr- is this safe to do, you think? it only happens at render time... --- lib/jekyll/related_posts.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/jekyll/related_posts.rb b/lib/jekyll/related_posts.rb index be0513fc..041ee551 100644 --- a/lib/jekyll/related_posts.rb +++ b/lib/jekyll/related_posts.rb @@ -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)