Using rsync to deploy your Jekyll site

Written by
Date: 2013-01-01 19:29:00 00:00

I have two methods to upload my Jekyll site. Well that is not really true, I change the method some every two months, because I switch hosting from time to time, not because I am using a bad one, but because I like testing new hosting services.

When I am using places like NearlyFreeSpeech or Linode I generate my site in the remote server or use rsync to upload my site to the server.

The latter method have one complication. Because Jekyll recreates the site completely every time you add one new post, all posts have the date and time of today, (I wish it could be like nanoc). Because of this, rsync uploads all the site because timestamps have changes, so it "thinks" the file have changed.

The solution to this, is to use checksum instead of timestamps to check whether the site has changed or not. The command I use is:

rsync -v -rz --checksum --delete _site/ user@server:/path/

In this command is –checksum the most important option when you use rsync to deploy your Jekyll site. Using –delete is also important to delete in the destination all files that have been deleted on the source, the -c (compress) will save you bandwidth and time when uploading your site to the server.


The good thing of using this method is that Apache will not change the Etag, and the cache servers that have saved copies of your site, will continue to server the cached copies of the pages that have not been changed. This will reduce the load on your server, and may benefit you is you are paying for the consumed bandwidth.