Class: Jekyll::Strapi::StrapiPage
- Inherits:
-
Page
- Object
- Page
- Jekyll::Strapi::StrapiPage
- Defined in:
- lib/jekyll/strapi/generator.rb
Instance Method Summary collapse
-
#initialize(site, base, document, collection) ⇒ StrapiPage
constructor
A new instance of StrapiPage.
- #url_placeholders ⇒ Object
Constructor Details
#initialize(site, base, document, collection) ⇒ StrapiPage
Returns a new instance of StrapiPage.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# 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 |
Instance Method Details
#url_placeholders ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/jekyll/strapi/generator.rb', line 40 def url_placeholders requiredValues = @document.attributes.to_h.select {|k, v| v.class == String and @collection.config['permalink'].include? k.to_s } Utils.deep_merge_hashes(requiredValues, super) end |