Jekyll plugins on Github

Intro

Github allows you to host your website/weblog for free ... that is awesome! What's great whit Github hosting is that your site IS a git repo, so you benefits from all the git feature (versioning, diff, etc).

Even more awesome! Github support Jekyll and generate your web pages on the fly from your markdown files. For those who don't know, Jekyll is a static site generator that comes with a bunch of templates and plugins... wait!! plugins!? ... ho no! Github does not support plugins!

No need to panic, you can still generate your site locally and push the html content to Github, this is how:

Step by step guide

I found this interesting howto which describe the following steps:

  1. create a new branch that you are going to use as a working branch, let's call it "source":
git branch source
  1. add whatever you want to add to your website in this new branch

  2. tell jekyll to regenerate the html content of you site:

jekyll build
  1. once ready to publish, delete the "master" branch:
git branch -D master
  1. recreate a new "master"
git checkout -b master
  1. and tell git to filter the content of master:
git filter-branch --subdirectory-filter _site/ -f
  1. you can finally push your local changes to Github:
git push --all origin
Quick explanation

What you've done, is basically telling git to show only the content of the "_site/" directory from the master branch, this is what is going to be published by Github.

Troubleshooting

Found nothing to rewrite

If git refuses to filter your branch with this message, make sure that you haven't forgotten to remove "_site" from your .gitignore :)

git filter-branch --subdirectory-filter _site/ -f

Found nothing to rewrite