Class: JekyllNotion::CollectionGenerator

Inherits:
AbstractGenerator show all
Defined in:
lib/jekyll-notion/generators/collection_generator.rb

Instance Method Summary collapse

Methods inherited from AbstractGenerator

#initialize, #resource_id

Constructor Details

This class inherits a constructor from JekyllNotion::AbstractGenerator

Instance Method Details

#collectionObject



16
17
18
# File 'lib/jekyll-notion/generators/collection_generator.rb', line 16

def collection
  @site.collections[@notion_resource.collection_name]
end

#generateObject



5
6
7
8
9
10
11
12
13
14
# File 'lib/jekyll-notion/generators/collection_generator.rb', line 5

def generate
  @notion_resource.fetch.each do |page|
    next if file_exists?(make_path(page))

    collection.docs << make_doc(page)
    log_new_page(page)
  end
  # Caching current collection
  @plugin.collections[@notion_resource.collection_name] = collection
end