Class: JekyllOpenSdgPlugins::OpenSdgPage

Inherits:
Jekyll::Page
  • Object
show all
Defined in:
lib/jekyll-open-sdg-plugins/create_pages.rb

Overview

A Page subclass used in the ‘CreatePages` class.

Instance Method Summary collapse

Constructor Details

#initialize(site, base, dir, page, language) ⇒ OpenSdgPage

Returns a new instance of OpenSdgPage.



156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# File 'lib/jekyll-open-sdg-plugins/create_pages.rb', line 156

def initialize(site, base, dir, page, language)
  @site = site
  @base = base

  index_files = (!page.key?('filename') or page['filename'] == 'index.html' or page['filename'] == '')
  @dir = index_files ? File.join(dir, '/') : dir
  @name = index_files ? 'index.html' : page['filename']

  self.process(@name)
  self.data = {}
  self.data['language'] = language

  # Add anything else besides "folder" and "filename". This will catch
  # things like "layout" and "title", and anything else.
  page.each do |key, value|
    if key != 'folder' && key != 'filename'
      self.data[key] = value
    end
  end
end