TL;DR. GitHub Pages doesn’t currently support 3rd party theme gems. You can workaround this, by building Jekyll in your local machine or in a CI service like Travis-CI and push to Github the generated files inside
WARNING: This is not supposed to be a step by step tutorial, but my experience and some hints on how you can archive the same thing.
UPDATE: Since 29 of November 2017, GitHub Pages announced support for Jekyll Gem-based themes that are hosted on GitHub. This means that now you have two options to use Jekyll Gem-based themes on GitHub Pages:
- GitHub Pages new support for Gem-based themes Click here for more details.
- Building Jekyll in your local machine or in a CI service as discussed on this blog post.
The initial idea
I follow some tutorials, forked a few different themes, but it felt a hack to fork a repository, keep it update with original, making local changes which could result in future conflicts, bah That’s something that I didn’t want to do for a simple blog… I want to apply the KISS principle.
Then I find out that since version 3.2, Jekyll start supporting Gem-based themes, which seems what I was looking for, but after a quick search I find out this:
Note: Not all Jekyll themes are supported. For a list of Jekyll themes that are supported by GitHub Pages, see https://pages.github.com/themes.
A better way
Question: Use with GH pages without requiring fork?
Answer: … The problem is GitHub Pages doesn’t currently support 3rd party theme gems. Similar to how they don’t allow Jekyll plugins (except for a few that have been whitelisted). So instead of pushing commits to GH and having it build your site, you need to build it locally and push the contents of your _site folder. … A lot of people use CI services like Travis to build their site and deploy to GH.
This was exactly what I was trying to archive!
Basically if I perform the Jekyll build outside of github, like on my local machine or Travis-CI, I could still use Jekyll Gem-based themes, and push to github only the generated file inside
The most important files to get started are:
_config.ymlfor blog configuration (modified from https://github.com/mmistakes/minimal-mistakes)
.travis.ymlfor Travis-CI configuration (modified from https://github.com/biomadeira/jasper/blob/master/.travis.yml)
Rakefilewhich is invoked by Travis-CI to build Jekyll and push the
master branch(modified from https://github.com/biomadeira/jasper/blob/master/Rakefile)
gemfilewhere I put my dependencies like Github Pages or Jekyll, Gem-based Theme, and some build dependencies
And after some tweaking and failed build’s, I got it working!
In general I’m satisfied with the setup, Travis-CI does all the heavy lifting for me, it builds the site in every commit, although I would like that the build times were faster, currently they are around two and half minutes.
If you have any suggestion to improve, or any issue trying to reproduce what I describe, please let me know.