Changing My Jekyll Config

June 29, 2013

So I’ve been running this site on Jekyll for a while now hosted by GitHub pages. I like GitHub Pages for hosting however the way I was using it was to checkout my Jekyll source files and let GitHub Pages compile and render my site. This made some things easier, but I decided that I’d like to get a little crazy and start playing around with plugins. GitHub Pages out of the box does not support plugins because it would be a security issue. The way around this of course is to separate your source and site into different branches and allow GitHub Pages to just generate the static pages generated by my local copy of Jekyll.

This was in fact a little tricky for me because I’m not a git guru yet. Here’s what I did.

  1. Create a new folder structure locally with two clones of my website repo. One is master and the other is source

  2. Rename my master branch to source via git branch -m master source

  3. Created the source remote branch via git push origin source

  4. Go into master folder (and branch) and delete all the files via git rm -fr . and git commit

  5. Go back into my source folder and update my _config.yml file and specify destination: ../master and commit

  6. Rebuild site into master folder via jekyll build

  7. Go into master folder and add and commit all the generated files

  8. Push everything out to GitHub

Now the site source is kept in the source branch and the generated site is in the master branch. This is only for username.github.com sites. If you wanted to do this for a project site you would do the same thing only use gh-pages instead of master.


Profile picture
Written by Andrew Shell, a web developer from Madison, WI.