Sha256: b4614370716d5abfc382e8acd0232967c7f503fdf634020181dbc0e249f0864f
Contents?: true
Size: 1.08 KB
Versions: 1
Compression:
Stored size: 1.08 KB
Contents
module Jekyll class Authors class << self def authors?(site) (site.data.key?('authors') || site.config.key?('authors')) end def merge_authors(site) site.config['authors'].merge!(site.data['authors']) { |_key, v1, _v2| v1 } end def default_author?(site) site.config.key?('author') end def default_author(site) site.config['author'] = site.config['authors'].values[0] end def post_author?(post) (post.author.is_a?(String) && post.site.config['authors'].key?(post.author)) end def attach_author(post) post.data['author'] = post.site.config['authors'][post.author] end end end end Jekyll::Hooks.register :site, :post_read do |site| Jekyll::Authors.merge_authors(site) if Jekyll::Authors.authors?(site) if !Jekyll::Authors.default_author?(site) && Jekyll::Authors.authors?(site) Jekyll::Authors.default_author(site) end end Jekyll::Hooks.register :posts, :pre_render do |post| Jekyll::Authors.attach_author(post) if Jekyll::Authors.post_author?(post) end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
jekyll-author-0.1.0 | lib/jekyll/jekyll-author.rb |