Mistress of My Domain

AutoPage for Tag ruby Page 1 of 2

This page is automagically created and paginated for each tag available in the posts on this site

Jekyll: Writing a Jekyll::Generator

There is annoying little documentation about writing a generator for Jekyll, particularly since when searching for examples, there is so much noise in form of hits for "static site generator." Two decent examples are from Ricardo Lopes and Starr Horne of Honeybadger.

Starting at the beginning, you want to be putting my_generator.rb in _plugins/ in the root directory of your Jekyll site directory.

For an absolute "Hello, World" we can do:

class Generator < Jekyll::Generator
  def generate(site)
    puts "Hello, World!"
  end
end
which prints out to the terminal when you bundle exec jekyll serve. Look for it after Generating...

Read more

Jekyll: How to write an Include function

Getting Jekyll running was a little bit of a kerfuffle since I needed to update Ruby, but then Jekyll couldn't find the right version. Eventually this was resolved and I got Jekyll's out of the box test site up and running. The fact that Jekyll has a test server that runs on your development machine is very convenient, even if it doesn't run server side includes and the like. Read more

Subscribe to this blog