Jekyll::Prep
Prepare Jekyll page data using Ruby.
Installation
See Jekyll's documentation for installing Jekyll plugins.
Usage
- Create a
_prepdirectory in your Jekyll project. - Inside the
_prepdirectory, create.rbfiles that correspond to your.mdJekyll pages. For example, if you have a/people/jill.mdJekyll page then create a_prep/people/jill.rbfile. - Inside the
.rbfiles, define subclasses ofJekyll::Prep::Scriptthat define apreparemethod that will receive an instance of Jekyll::Page. The subclass namespaces must align with the.rbfile paths minus the leading underscore. For example, the file_prep/people/jill.rbshould containPrep::People::Jill. - Inside the prepare methods, do whatever you want to
page.data.
# _prep/people/jill.rb
module Prep
module People
class Jill < Jekyll::Prep::Script
def prepare(page)
page.data['something new'] = 'was added during prep'
end
end
end
endContributing
- Fork it (https://github.com/gregoryjscott/jekyll-prep/fork).
- Create your feature branch (
git checkout -b my-new-feature). - Commit your changes (
git commit -am 'Add some feature'). - Push to the branch (
git push origin my-new-feature). - Create a new Pull Request.