4 minute read / Mar 20, 2014 /
The Machinery of Blogging
I’ve been getting a few questions about the tools I use to publish this blog, so I figured I’d write about it and reveal the machinery behind the curtain. I use four main tools Jekyll, Github Mou, and RStudio. Jekyll is the blogging engine; Github is the hosting provider; Mou is the app I use to write these posts; and RStudio is the place I analyze data and make charts.
The most important tool is the engine. I chose Jekyll because Jekyll sites load faster than most other blogging platforms. Jekyll is an open source project created by two engineers at Github. At Google, I saw the importance of page load times on user experience and that has always stuck with me. Also, I wanted the ability to instrument my blog to run experiments and understand the impact on reading habits which meant hosting my own blog rather than using a platform.
Most blogging platforms (Wordpress, Tumblr, etc) store user posts in a database. When a blog post page is requested by a blog visitor, Wordpress pings the database for the post content, injects the content into the blog template and sends it to the browser. Said another way, content compilation occurs at the time of request.
Jekyll works very differently. A static-site generators (SSG), Jekyll eliminates the database by compiling posts as I write them, instead of when the user asks for them. When a visitor arrives, the content has been prepared already. Because the website is pre-compiled, users load pages faster. SSGs have other benefits, too. Security is much stronger and hosting is cheaper. I host on Github Pages, which is about $7 per month.
But the speed comes with a handful usability costs. There is no website to create a new post. Instead, I write the posts in a text-editor on my laptop. I use Mou, an open-source markdown editor, that has a preview pane so I can see what the final post will look like as I type it. Mou also has a spell-checking feature. I wish Mou or other tools also checked grammar the way Microsoft Word has for more than a decade.
Also, there is no save or publish button with Jekyll. To publish new posts and fix errors in previous ones, I use git, a command line tool. Because the site must compile after each change, I wait about 5 minutes before a new post goes live. Though Github seems to have accelerated this process quite a bit recently. There is one project that provides a UI on Jekyll/Github sites called Prose.io. But I’ve found it’s very buggy.
Because of these challenges, I don’t recommend Jekyll for everybody. Ghost is likely a much better alternative for most companies who need to control their own design. Svbtle and Medium are also wonderful options for individuals. An important difference between the two: Svbtle allows authors to use an existing domain name and Medium provides one for you.
To analyze data and create charts, I use a code editor for R called RStudio and two terrific libraries from Hadley Wickham, dplyr for data manipulation and ggplot2 for visualization. Plot.ly is a wonderful alternative particularly when I want to build interactive charts.
For a while I used Excel/Numbers, but the programming nature of R makes it much easier to re-run previous analyses with new data. Also, R has a huge collection of different tools for creating box plots and maps, and also doing more sophisticated types of analysis like linear modeling and moving averages.
I designed the site using Bootstrap.js, Twitter’s excellent library for responsive layouts. Typekit provides two fonts, P22-Underground for the titles and Minion-Pro for paragraph text.
The blog is instrumented with Google Analytics with custom events. I’ve instrumented all the sharing actions (Twitter, FB, HackerNews etc.), the subscription actions (email + rss) and also the Read this Next feature at the bottom of the page.
I’m missing a tool for automatically resizing images to the right dpi and width, to maximize page load times. Today, I do this by hand with Apple’s Preview if the file size is greater than 200 kb.
That’s my blogging machinery. If you have suggestions on a better toolkit or thoughts on this one, I’d love to hear them. Send me a tweet.