Something I really like about my blogging setup here on composition.al is that my posts are just plain old version-controlled text files. Years ago, Dave Herman remarked on how nice it is to be able to blog using one’s text editor, and I feel the same way. But there’s so much more to it than just being able to write my posts in my editor of choice. For me, the more important thing is that I can make use of the vast number of tools out there for manipulating text, including and especially versioned text. Because of that, I don’t have to wait for my blogging framework to implement this or that feature. I can just use tools that already exist.
Here’s an example: let’s say I want to know what the longest posts on this blog have been.1 If I were using, say, WordPress, I’m not sure how I would go about figuring that out. The interface might or might not expose that information; I might have to install a plugin or something, or manually copy and paste the text of my posts into a tool that will show a word count. But since my posts are just text files, it’s just a couple of quick shell commands chained together and run in the directory where all my posts live:
1 2 3 4 5 6 7 8 9 10 11
From the output of that command, I can see that my longest post is “‘Experiencing computing viscerally’: my PG Podcast interview about !!Con” from August 2016, although that one hardly counts because it’s a transcript of an audio interview. The next longest post is “The LVar that wasn’t”, from December 2013, which weighed in at 4526 words. The word count includes a small amount of overhead for stuff like the Markdown front matter in each post, but it’s mostly accurate.
Let’s say that I want to spell-check all my posts. Since I have
aspell installed, that’s pretty easy, too:
This launches the
aspell interface, in which I can interactively correct typos that it finds in each file, or add words it doesn’t know to my local dictionary. I tried it just now on the whole blog and found misspellings of ‘heterogeneous’, ‘narrative’, ‘necessarily’, ‘difference’, and ‘which’, all of which are now fixed.
History of a post
Because I use git to version all my posts, I can see a version history of any post using
git-diff. Let’s say that I want to see all the changes made to the post “Refactoring as a way to understand code” from a couple years back. The command
shows me the answer. It turns out that I made a small copy edit about an hour after writing the post, correcting the phrase “get a more visceral sense of what it’s doing” to “give me a more visceral sense of what it’s doing”. (I seem to be into this whole viscerality thing.) A couple of days later, I added the sentence “I can sympathize.” to the post. A year and a half later, I removed the tag “programming” and added “refactoring” instead.
Seeing the most-edited posts
With only three edits after the original post, I suspect that “Refactoring as a way to understand code” is actually one of my less heavily-edited posts. How can I see which ones are most heavily edited? The
git-effort command from the wonderful git-extras collection can help. If I want to see all my posts that have been edited twenty times or more, I can do this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
git-effort lists those posts for me, first ordered by filename (which, because of the naming convention I use, is also by date) and then ordered by the number of commits. It turns out that I have four posts that have been edited twenty or more times, with “Thoughts on ‘Adversarial examples in the physical world’” being the most edited post by a pretty wide margin. Fascinating!
The tools I use
I use Octopress to generate this blog. When I started the blog in early 2013, Octopress was still quite popular; by 2015, it had fallen far enough out of fashion that a commenter on Hacker News remarked on my anachronistic use of it. I suppose that person would think I’m a dinosaur for still using Octopress even now, as 2017 is coming to an end. There are any number of other static site generators out there that would probably do everything I want and are probably less janky than Octopress, but I keep using it out of inertia and because it still does the job well enough. I’ll probably switch from Octopress to plain Jekyll at some point, since Octopress is just a wrapper around Jekyll, and I don’t really use most of the features Octopress adds.
The particular blogging framework I use is beside the point, though. What’s more important to me is how easy it is to work with my blog using the wider world of command-line text manipulation tools, and it’s the fact that the posts are stored as versioned text that makes that possible. That, to me, is the real power of static site generation tools — it’s not so much about what those tools themselves do as it is about everything else that the posts-as-versioned-text approach enables, none of which is particular to Octopress or Jekyll or any other static site generator.
I’m always worried that My Best Blogging Days Are Behind Me and that I Never Blog About Anything Substantial Anymore, so it’s reassuring to look back and see that my longest posts are actually pretty evenly spread over the years that this blog has existed, and in fact, three of the nine longest posts were written within the last year. (Length isn’t the same thing as substance, of course, but there’s no shell command for quantifying substance yet.) ↩