class Jekyll::Archives::Archives
Constants
- DEFAULTS
Public Class Methods
new(config = nil)
click to toggle source
# File lib/jekyll-plugin-gkarchive.rb, line 40 def initialize(config = nil) @config = Utils.deep_merge_hashes(DEFAULTS, config.fetch("jekyll-archives", {})) end
Public Instance Methods
generate(site)
click to toggle source
# File lib/jekyll-plugin-gkarchive.rb, line 44 def generate(site) @site = site #@posts = site.posts site.collections.each do |coll_name, coll_data| if( !coll_data.nil? && coll_name == 'articles') @posts = coll_data end end @archives = [] @site.config["jekyll-archives"] = @config read_categories @site.pages.concat(@archives) @site.config["archives"] = @archives end
read_categories()
click to toggle source
# File lib/jekyll-plugin-gkarchive.rb, line 63 def read_categories posts = [] @posts.docs.each do |key, value| posts << key end @config["category"].each { |cat| @archives << Archive.new(@site, cat, "category", posts) } end