Class: JekyllDetailGenerator::DetailPage

Inherits:
Jekyll::Page
  • Object
show all
Defined in:
lib/jekyll-detail-generator.rb

Instance Method Summary collapse

Constructor Details

#initialize(site, item, collection_name, layout, title, url) ⇒ DetailPage

Returns a new instance of DetailPage.



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/jekyll-detail-generator.rb', line 24

def initialize(site, item, collection_name, layout, title, url)
  @site = site             # the current site instance.
  @base = site.source      # path to the source directory.
  @dir  = collection_name + "/" + url        # the directory the page will reside in.

  # All pages have the same filename, so define attributes straight away.
  @basename = 'index'      # filename without the extension.
  @ext      = '.html'      # the extension.
  @name     = 'index.html' # basically @basename + @ext.

  self.process(@name)
  base_path = @site.layouts[layout].path
  base_path.slice! @site.layouts[layout].name
  self.read_yaml(base_path, @site.layouts[layout].name)

  self.data["item"] = item
  self.data["title"] = title
end

Instance Method Details

#url_placeholdersObject

Placeholders that are used in constructing page URL.



44
45
46
47
48
49
50
51
# File 'lib/jekyll-detail-generator.rb', line 44

def url_placeholders
  {
    :path       => @dir,
    :category   => @dir,
    :basename   => basename,
    :output_ext => output_ext,
  }
end