Class: JekyllFeed::Generator

Inherits:
Jekyll::Generator
  • Object
show all
Defined in:
lib/jekyll-feed/generator.rb

Instance Method Summary collapse

Instance Method Details

#generate(site) ⇒ Object

Main plugin action, called by Jekyll-core



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/jekyll-feed/generator.rb', line 9

def generate(site)
  @site = site
  if disabled_in_development?
    Jekyll.logger.info "Jekyll Feed:", "Skipping feed generation in development"
    return
  end
  collections.each do |name, meta|
    Jekyll.logger.info "Jekyll Feed:", "Generating feed for #{name}"
    (meta["categories"] + [nil]).each do |category|
      path = feed_path(:collection => name, :category => category)
      next if file_exists?(path)

      @site.pages << make_page(path, :collection => name, :category => category)
    end
  end
  generate_feed_by_tag if config["tags"] && !@site.tags.empty?
end