Class: Jekyll::AmpGenerator

Inherits:
Generator
  • Object
show all
Defined in:
lib/jekyll/amp_generate.rb

Overview

Generates a new AMP post for each existing post

Instance Method Summary collapse

Instance Method Details

#generate(site) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
# File 'lib/jekyll/amp_generate.rb', line 32

def generate(site)
  languages = site.config['languages']
  dir = site.config['ampdir'] || 'amp'
  languages.each do |lang|
    site.lang = lang
    site.posts.doc.each do |post|
      next if post.data['skip_amp'] == true
      site.pages << AmpPost.new(site, site.source, File.join(dir, post.id), post)
    end
  end
end