Class: Jekyll::OpenProjectHelpers::FilteredIndexPage

Inherits:
Page
  • Object
show all
Defined in:
lib/jekyll-theme-open-project-helpers/filterable_index.rb

Overview

Each software or spec item can have its tags, and the theme allows to filter each index by a tag. The below generates an additional index page for each tag in an index, like software/Ruby.

Note: this expects “_pages/<index page>.html” to be present in site source, so it would fail if theme setup instructions were not followed fully.

Instance Method Summary collapse

Constructor Details

#initialize(site, base, dir, tag, items, index_page) ⇒ FilteredIndexPage

Returns a new instance of FilteredIndexPage.



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/jekyll-theme-open-project-helpers/filterable_index.rb', line 29

def initialize(site, base, dir, tag, items, index_page)
  @site = site
  @base = base
  @dir = dir
  @name = 'index.html'

  self.process(@name)
  self.read_yaml(File.join(base, '_pages'), "#{index_page}.html")
  self.data['tag'] = tag
  self.data['items'] = items
end