Jekyll Plugins in Github Pages
I thought it was high time I made some effort in cleaning up and streamlining my post composition workflow, while riding the wave of my small redesign).
The first thought I had was that I should damn well try to use
as that’s what most sane people who use Jekyll (and
Middleman and other blog-friendly
generators) use. Along those lines, Jekyll
Bootstrap comes with a handy Rake
rake post title="", which will generate a Markdown file in
_posts with the appropriate filename and YAML frontmatter. I made a
minor tweak to include the time, as I use that in my post layout.
Next, I wanted to stop the copy pasta involved in rendering my silly 3D shadow effect with images. So, I made a quick and dirty (I mean really dirty) Jekyll plugin that acts like a view partial, taking in the necessary parameters to spit out my precious markup without me having to repeatedly type/paste said markup. Works well enough, but I’m sure there’s refactoring to come (like, I hate that I’m not passing my parameters as an object).
In order to use my plugin — and any plugin, for that matter
— I would have to adjust my workflow with Github Pages,
since it runs Jekyll in “safe mode” and doesn’t
execute plugins (basically, arbitrary Ruby, so
that seems reasonable of them). This basically means I need to compile
the posts and pages on my local machine, rather than let Github Pages do
it. ixti has a good post
on how to go about this in a way that isn’t too painful;
basically, I moved my repo’s
master branch to a new branch called “source”, made that my
default branch in Github, and used the
rake publish task ixti outlined to do a
Jekyll compilation, move the resulting
_site output to master, and
force push it up, all in one command.
Felt a little nervous doing a
force push, especially to master, but
that was just my conditioning after years of avoiding exactly that.
Besides, my source branch is effectively the new master. And now I can
use Jekyll plugins on my Github
Some things I have to be careful about: it doesn’t matter
what’s pushed up to origin/source — the Jekyll compilation
that happens as a result of
rake publish will compile anything and
everything. So, I need to make sure I’m clean locally before
publishing; I basically ensure that
git status returns
commit before I dare
rake publish. I could surely adjust the Rake
task to smooth this over — a Github WebHook feels like
the right place. That’ll be for a future iteration…
Hell, I’m just happy to be using Markdown!