Class: JekyllIndexPages::Author

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

Instance Method Summary collapse

Instance Method Details

#generate(site) ⇒ Object



5
6
7
8
9
10
# File 'lib/jekyll-index-pages/author.rb', line 5

def generate(site)
  authors = Hash.new { |hash, key| hash[key] = [] }
  authored_docs = site.posts.docs.select { |doc| doc.data.key?("author") }
  authored_docs.each { |doc| authors[doc.data["author"]] << doc }
  site.data["authors"] = authors
end