I use a homegrown shell script to publish my posts on this site. It uses the WP-CLI command line interface for WordPress. An earlier version used Stuart Rackham‘s blogpost.py and the XML-RPC interface.
It uses the first couple lines of your post files as “front matter.” The first line is the post id, second line is optional title. If the first line is empty, it creates a new post and fills in the id.
It’s has gone through a few iterations. I used to store my post files in Subversion (now git), so I first tried using svn st
to determine which post files were modified. That worked, but it tied publishing posts to checking them into Subversion, which I didn’t like.
Next, I tried hashing all of the post files and comparing them to the stored hashes in their .blogpost
files. That worked, but it was pretty heavyweight. I have hundreds of posts and pages, so hashing them all takes some time, and usually only a few of them have changed anyway.
I finally settled on a hybrid of hashing and mtime. I loop over all of the files in order of last modification time, starting with the most recent. I hash each one, compare that to its .blogpost
file, and publish the file if it’s changed. I stop at the first file that hasn’t changed.