Class: Jekyll::PagedFeedPageGenerator

Inherits:
Generator
  • Object
show all
Defined in:
lib/jekyll/paged_feed_page_generator.rb

Instance Method Summary collapse

Instance Method Details

#generate(site) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/jekyll/paged_feed_page_generator.rb', line 5

def generate(site)
  pages_total = (site.posts.docs.count.to_f / site.config["episodes_per_feed_page"]).ceil

  site.config["episode_feed_formats"].each do |page_format|
    name = "episodes." + page_format + ".rss"
    page = PagedFeedPage.new(site, site.source, ".", name, 1, pages_total, page_format)
    site.pages << page
    (1..pages_total).each do |page_number|
      name = "episodes" + page_number.to_s + "." + page_format + ".rss"
      page = PagedFeedPage.new(site, site.source, ".", name, page_number, pages_total, page_format)
      site.pages << page
    end
  end
end