Class: JekyllIndexPages::Collection

Inherits:
Jekyll::Generator
  • Object
show all
Defined in:
lib/jekyll-index-pages/collection.rb

Instance Method Summary collapse

Instance Method Details

#generate(site) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/jekyll-index-pages/collection.rb', line 5

def generate(site)
  collections = Hash.new { |hash, key| hash[key] = [] }
  config = site.config["index_pages"] || {}
  config.each do |kind, item|
    next if kind.match(/posts|categories|tags|archive|authors/)
    next if !item.has_key?("collection")
    coll_name = item["collection"]
    collection = site.collections[coll_name]
    collection.docs.each { |doc| collections[coll_name] << doc }
  end
  site.data["collectionz"] = collections if config.length > 0
end