class Jekyll::Strapi::StrapiPage

Public Class Methods

new(site, base, document, collection) click to toggle source
# File lib/jekyll/strapi/generator.rb, line 19
def initialize(site, base, document, collection)
  @site = site
  @base = base
  @collection = collection
  @document = document

  @dir = @collection.config['output_dir'] || collection.collection_name
  # Default file name, can be overwritten by permalink frontmatter setting
  @name = "#{document.id}.html"

  self.process(@name)
  self.read_yaml(File.join(base, "_layouts"), @collection.config['layout'])

  # Use the permalink collection setting if it is set
  if @collection.config.key? 'permalink'
    self.data['permalink'] = @collection.config['permalink']
  end

  self.data['document'] = StrapiDocumentDrop.new(@document)
end

Public Instance Methods

url_placeholders() click to toggle source
Calls superclass method
# File lib/jekyll/strapi/generator.rb, line 40
def url_placeholders
  requiredValues = @document.to_h.select {|k, v|
    v.class == String and @collection.config['permalink'].include? k.to_s
  }

  Utils.deep_merge_hashes(requiredValues, super)
end