Skip to content

Github Pages Support

Samuel Volin edited this page Jan 20, 2016 · 6 revisions

Github Pages Support

By default github prevents jekyll blogs from using plugins. This is done intentionally to prevent malicious code from being executed on github servers. Although this makes using Polyglot (and other jekyll plugins) harder to use, it's still doable.

Building _site/ to gh-pages

Instead of hosting your Jekyll blogging engine on github, you can develop your jekyll website on a separate branch, and then push the built _site/ contents to your gh-pages branch. This allows you to manage and source-control your website development with github without having to rely on github to build your website!

You can do this by maintaining your Jekyll content on a separate branch, and only committing the _site/ folder to your gh-pages branch. Because these are just static html pages in folders, github will host them like any other gh-pages content.

Automate it!

This process is helped tremendously with a simple script that will build your website and commit the _site/ folder to your gh-pages. A lot of people have one. Here's one. Here's another. Here's mine:

# publi.sh
# change the branch names appropriately
git checkout site
rm -rf _site/
jekyll build
git add --all
git commit -m "`date`"
git push origin site
git subtree push --prefix  _site/ origin gh-pages