Jekyll on Heroku

Published on December 29, 2009 by Jesse Storimer

This blog is published using Jekyll. Jekyll is a static site generator, so you write your posts and pages on your local machine, generate your static HTML site and then publish it using a service that serves static files. Like GitHub Pages or Slicehost.

But neither of those services are free, and my blog has nowhere near enough traffic that it should cost me money, so I wanted to use the free Heroku plan. This is the method I have been using to publish my blog for the past month.

Basically Heroku treats my blog like its a Sinatra app. When you hit the root of the application it serves the index.html from the _site/ folder, and then the links from that page take the user where they want to go.


I recently noticed that there is a project called rack-jekyll that is supposed to make it easy to publish your Jekyll site with Rack. I tried out this project and it failed miserably when trying to display my blog.

The method here is much simpler. The nice thing about the fact that this is a Sinatra app is that you have some built in niceties. Want custom 404 pages? Sinatra has that. Need to demonstrate some dynamically generated code? Just set up another route and go right ahead.

Local Development

Use the jekyll --auto --server command to develop locally.


To deploy your jekyll site to Heroku:

  1. Make sure that your _site/ folder is not in the .gitignore file.
  2. Add the two files from the gist above.
  3. Commit changes.
  4. heroku create (first time around)
  5. git push heroku master