Published with…
I’ve mentioned to a few friends, and publicly on my Colophon, that this website is published with a custom static-file blog engine. Here are the details of how it works.
The main work of producing the site is done by one 200-line PHP file. (It was originally Ruby, but I dislike ERB and the other Ruby template systems so I suffered the pain of rewriting in PHP, just to use Twig.) The actual posts are all plain text files in folders by section (articles, links, photos) and date.1 There is no database anywhere. The publishing script takes these files, the Twig templates, and various assets (like stylesheets) and uses them to publish the website as a set of HTML files.
(If you’re interested, I have an example of a text file which stores a post.)
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.
When the changes on my computers arrive at my server, they’re immediately noticed by inotify, which is attached to a Ruby script, responsible for updating the whole site whenever I make a change (by shelling out to PHP).
This is particularly cool: I have a drafts folder for my unfinished posts. (Including, as I’m writing, this one.) When I save a file there with the Publish: now line in the header, it’s immediately posted publicly, automatically moving to the right place in the directory hierarchy. In addition, cron runs the publisher every five minutes regardless of any changes being made, so I can set Publish to any time in the future and have it automatically pushed live at that time. I’ve only done this once or twice, but it’s quite useful.
One last cool feature is Flickr integration. This took 0 lines of code in the main publisher script; it’s all done by ifttt. Any time I post a Flickr photo publicly with a certain tag, it generates a post for the photos section and automatically puts it in the drafts folder. So (with a 15 minute delay) I can publish my Flickr photos straight to the blog in just two or three steps.
You might notice that it’s not linked to any blog editing interface like MarsEdit. I’d love to hook it up, but I write in BBEdit anyway so the only real advantage would be in post management, for which the Finder is sufficient.
-
Most posts are written in Markdown, but some are in Textile because I use HTML tags for which Markdown doesn’t have shortcuts. (Eg.
cite,del, etc. — plus deliberately non-semantic tags likei.) ↩