From 76fa7f016b6f161afb37a47cb34ac0838312767c Mon Sep 17 00:00:00 2001 From: Tomotaka Sakuma Date: Mon, 28 Nov 2011 16:32:20 +0900 Subject: [PATCH] Fix an issue NoMethodError happens in case number of files under _posts is less than limit_posts. --- lib/jekyll/site.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index 9c24f8e497c..c7c437d7557 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -173,7 +173,10 @@ def read_posts(dir) self.posts.sort! # limit the posts if :limit_posts option is set - self.posts = self.posts[-limit_posts, limit_posts] if limit_posts + if limit_posts + limit = self.posts.length < limit_posts ? self.posts.length : limit_posts + self.posts = self.posts[-limit, limit] + end end # Run each of the Generators.