diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index a4d21109661..c47ccd2df10 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -174,7 +174,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.