Class: OctopressCategoryList::Plugin

Inherits:
Octopress::Ink::Plugin
  • Object
show all
Defined in:
lib/octopress-category-list/plugin.rb

Instance Method Summary collapse

Instance Method Details

#generate(site, config) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/octopress-category-list/plugin.rb', line 13

def generate(site, config)
  @conf = inject_configs

  @template = find_template('category_list.html')

  return unless @template

  permalink = "/" + @conf['categories_dir'] + "/index.html"
  if page = @template.new_page({
      'lang'      => nil,
      'title'     => @conf['category_list_title'],
      'permalink' => permalink,
      'plugin'    => self
    })

    Octopress::Ink::Bootstrap.add_page(page, nil)
    Octopress.site.pages << page
  end

end

#inject_configsObject



34
35
36
37
# File 'lib/octopress-category-list/plugin.rb', line 34

def inject_configs
  @conf = self.config
  @conf = Jekyll::Utils.deep_merge_hashes(YAML.load(Config.default_config), @conf)
end

#registerObject



6
7
8
9
10
11
# File 'lib/octopress-category-list/plugin.rb', line 6

def register
  super
  if Octopress::Ink.enabled?
    self.generate(Octopress.site, config)
  end
end