Fix an issue NoMethodError happens in case number of files under _posts is less than limit_posts.

This commit is contained in:
Tomotaka Sakuma 2011-11-28 16:32:20 +09:00
parent 1da88bb30a
commit 76fa7f016b
1 changed files with 4 additions and 1 deletions

View File

@ -173,7 +173,10 @@ module Jekyll
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.