I am trying to generate category pages for my github pages blog using jekyll. When i run locally using jekyll serve
this works because it can use my plugin.
Using this example from the docs doesn't work because github will not generate custom plugins:
module Jekyll
class CategoryPage < Page
def initialize(site, base, dir, category)
@site = site
@base = base
@dir = dir
@name = 'index.html'
self.process(@name)
self.read_yaml(File.join(base, '_layouts'), 'category_index.html')
self.data['category'] = category
category_title_prefix = site.config['category_title_prefix'] || 'Category: '
self.data['title'] = "#{category_title_prefix}#{category}"
end
end
class CategoryPageGenerator < Generator
safe true
def generate(site)
if site.layouts.key? 'category_index'
dir = site.config['category_dir'] || 'categories'
site.categories.each_key do |category|
site.pages << CategoryPage.new(site, site.source, File.join(dir, category), category)
end
end
end
end
end
However, it would work if I could generate my own pages that are not in the _site
directory. I would then check these in as "regular" pages even though they are generated by the system.
Is there any way to generate category pages outside of the _site
directory with jekyll?