Github Pages: what nobody is telling
Apr 9, 2018
2 minute read

Github Pages runs Jekyll in safe mode when building the site and restricts the users to only use some plugins. However building the site locally and then pushing to Github only the contents of the _site directory will overcome this issues. Also this way you can use any static site generator of your choice.

I have seen some articles scratching the surface of this method, however, I didn’t find any tutorial on this. As a beginner myself I fought this might be not very well known to others.

So if you already have your repository created, your files and your installation set up, there are two places Github offers you to place your site’s content: the master branch and the /docs folder inside the master branch.

github build place screenshot

Is you the build source to be the master branch, naturally you’ll create another branch (like devel), and push the files your static site generator needs, and then checkout to the master branch the output of your static site generator. On the other hand, if you choose the second option you just need to build the site to the /docs folder and push that. No need for additional branches or additional complexity.

And that’s it. If you’re using Jekyll as your static site generator you can follow my more general and in-depth tutorial here.



comments powered by Disqus