Rafael Bugajewski home
 

Custom Static Site Generator

Wednesday, 04 January 2012

David Kendal:

The PHP generator script runs on the server. The entire blog is kept in Dropbox, and through a dummy account linked to my server synchs automatically with the server whenever I make a change. Most iPhone and iPad text editors work with Dropbox, so I can write and publish wherever I am.

I always used WordPress for all of my sites. I also recommended the publishing platform to a lot of clients and friends who wanted to run a website that wasn’t necessary a blog. During the last couple of months I begun switching more and more sites to static sites that are automatically generated on the command line. This has not only the benefit of a much better performance, it is also more secure. There are no scripts that could potentially give an attacker the chance to take over the server or at least your user account.

I started with this site and migrated it to Jekyll. My publishing workflow was rather tedious. I had to manually create a text file, and then commit it to the server. An update hook on the server automatically updated the published site. Inspired by David’s article I got rid of the Git part and replaced it with Dropbox. The server instance runs as a separate user. It has only access to the raw website and not my whole personal Dropbox folder. I’ve written a small server-side script that checks every two minutes if there are any changes inside Jekyll’s post folder. When I modify an article or create a new one, the site is regenerated. I wanted to use incron, but this server doesn’t have inotify and there’s no chance to install it. Additionally I created a Keyboard Maestro script that takes the current selection from Safari, creates a new text file in the drafts folder and optionally opens BBEdit with a new article and the quote.

The best thing about this setup is that I can write articles and publish them from almost everywhere. I wanted to share all scripts, but they’re tightly coupled to installation and deployment paths. It needs a lot more work to clean everything up and make it usable for everyone.