]>
git.r.bdr.sh - rbdr/r.bdr.sh/blob - jekyll/_plugins/category_generator.rb
3 class CategoryIndex
< Page
4 def initialize(site
, base
, dir
, category
)
11 self.read_yaml(File
.join(base
, '_layouts'), 'category_index.html')
12 self.data['category'] = category
14 category_title_prefix
= site
.config
['category_title_prefix'] || 'Category: '
15 self.data['title'] = "#{category_title_prefix}#{category}"
16 self.data['description'] = "Lista de articulos categorizados #{category} en Abuguet, el blog mas guapo de videojuegos."
20 class CategoryGenerator
< Generator
24 if site
.layouts
.key
? 'category_index'
25 dir
= site
.config
['category_dir'] || 'categories'
26 site
.categories
.keys
.each
do |category
|
27 write_category_index(site
, File
.join(dir
, category
), category
)
32 def write_category_index(site
, dir
, category
)
33 index
= CategoryIndex
.new(site
, site
.source
, dir
, category
)
34 index
.render(site
.layouts
, site
.site_payload
)
35 index
.write(site
.dest
)