diff --git a/lib/jekyll/reader.rb b/lib/jekyll/reader.rb index deff185b..fa472be2 100644 --- a/lib/jekyll/reader.rb +++ b/lib/jekyll/reader.rb @@ -161,5 +161,12 @@ module Jekyll def aggregate_post_info(post) site.posts << post end + + + def limit_posts() + limit = site.posts.length < site.limit_posts ? site.posts.length : site.limit_posts + site.posts = site.posts[-limit, limit] + end + end end \ No newline at end of file diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index 3dc5884f..ce2374d4 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -149,7 +149,7 @@ module Jekyll reader.read_posts(dir) reader.read_drafts(dir) if show_drafts posts.sort! - limit_posts! if limit_posts > 0 # limit the posts if :limit_posts option is set + reader.limit_posts() if limit_posts > 0 # limit the posts if :limit_posts option is set entries.each do |f| f_abs = reader.in_source_dir(base, f) @@ -374,11 +374,6 @@ module Jekyll pages.any? { |page| page.uses_relative_permalinks } end - def limit_posts! - limit = posts.length < limit_posts ? posts.length : limit_posts - self.posts = posts[-limit, limit] - end - def site_cleaner @site_cleaner ||= Cleaner.new(self) end