Anton Lindstrom (about, @twitter, @github)

Jekyll on Heroku

Published:

I have been writing about the move of my blog and several other components of my domain to the cloud. I moved the website to Heroku and is now using Jekyll as a blog plattform which caused some new issues.

The problem was that I used other name conventions for files, as: /journal. Now the pages are named as /journal.html and the rewrites are using 302 HTTP responses (permanently moved) to support the old links. This is used with the help of a plugin called rack-rewrite and imported into Heroku with a gem manifest. Then in the config.ru file just type the following:

require "rack/jekyll"
require "rack/rewrite"

use Rack::Rewrite do
  r302 '/journal', '/journal.html'
  r302 '/moved_from', '/moved_to'
end

run Rack::Jekyll.new

Then it is just a push away from rewriting paths in Jekyll on Heroku. The readme on the rack-rewrite page is very useful for writing rewrites like in the Apache mod_rewrite way.

For more information about the rack/jekyll gem check out the readme on Github.