Sha256: c74b2f784b89640c3872c59bcce3a1a67183223a1d2f72c5e76a8b80ed5fd552
Contents?: true
Size: 1.43 KB
Versions: 1
Compression:
Stored size: 1.43 KB
Contents
module Jekyll class PagedFeedPage < Page def initialize(site, base, dir, name, page_number, pages_total, format) @site = site @dir = "/" @name = name self.process(@name) self.read_yaml(File.join(base, '_layouts'), 'feed.xml') self.data['next'] = pages_total > page_number ? "?page=" + (page_number + 1).to_s : nil self.data['last'] = pages_total > 1 ? "?page=" + pages_total.to_s : nil self.data['prev'] = case page_number when 1 then nil when 2 then "" else "?page=" + (page_number - 1).to_s end self.data['myself'] = page_number == 1 ? nil : "?page=" + page_number.to_s self.data['format'] = format self.data['page_number'] = page_number end end class PagedFeedPageGenerator < Generator safe true def generate(site) pages_total = site.posts.docs.count / 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_format + ".rss?page=" + page_number.to_s page = PagedFeedPage.new(site, site.source, ".", name, page_number, pages_total, page_format) site.pages << page end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
jekyll-octopod-0.6.1 | assets/_plugins/feed_generator.rb |