I finally got Jekyll and github pages working together in beautiful harmony. It wasn’t beautiful the first time I tried.
The first time I installed Jekyll, it was a tangle of dependencies and confusion. I don’t know anything at all about ruby, so all of the gem and rbenv and rvm and bundle commands were mysterious. Gems want to go in /var/lib by default so I guess I want to use sudo? Nope! Mismatched versions all over the place. YAML errors. Missing gems. The kinds of stackoverflow questions where every person suggests a different solution and none of them seem to have any overlap. And somehow, after a bunch of hitting it with a hammer, two jekyll setups, one nested inside each other. Or at least two _config.yml files.
Sometimes you have to stop, burn the whole thing to the ground and start again.
I uninstalled all of the gems, deleted /var/lib/gems, apt-get purged ruby. Deleted the github repo. Then started again:
- install ruby from apt. I didn’t install any of the version managers (which is what I think rvm and rbenv are?). I’ll care about them later if the situation arises where I need more than one version of ruby.
- set environment variables to install gems locally.
- write a .gemrc to say that I want to install everything locally. Is this necessary when I already set $GEM_PATH? Maybe not?
$ cat ~/.gemrc
- create a new jeykll blog
jekyll new whereistanya.github.io
That makes a directory called whereistanya.github.io.
- use that directory as the new git repository
Second time around, everything Just Worked. If the github repo is called yourusername.github.io, it’ll get automagically deployed to gh-pages. Some jekyll options also appear in the repo’s settings, but they’ve been mixed blessings: using the templates, for example, cause the site to break with this very useful error:
The page build failed with the following error: page build failed.
Github pages, you’re my hero.
Anyway, I’m sure that’s fixable. Maybe by adding gems for the templates to the Gemfile? But everything about ruby is new to me, so mostly I’m poking things and seeing what happens.
In short, I have no idea what I’m doing. This is my natural and favourite state and it usually means that I’m learning something fun.