Maintaining My Blog Post Queue

Because inspiration doesn't necessarily strike on demand, I like to stay a few posts ahead. For the last year, my procedure was to push a completed post to the site as a draft and then publish it when I was ready for it to appear on the site. The recent attack on WordPress administration pages and the subsequent inability to release pending drafts have made me rethink that strategy.

Now what I do is maintain a separate file on my local computer called push-queue.org that contains links to posts that are ready to go. Here's what the file looks like1:

* Ready to Post [3/5]
- [X] one-way-function
- [X] action-report
- [X] tags
- [ ] worst-passwd-tips
- [ ] hyper-super
ORG-LIST-END-MARKER
* Pending Posts

Those links are in normal Org format. For instance, the tags link looks like:

[[file://Users/jcs/org/blog/tags.org][tags]]

Naturally, being lazy, I don't want to maintain the push-queue.org file by hand so I wrote a bit of Elisp:

(defun jcs-add-to-push-queue ()
  "Add the file associated with the current buffer to post queue in
push-queue.org"
  (interactive)
  (let ((file (buffer-file-name)))
    (when (null file)
      (error "Buffer not associated with file."))
    (find-file "/Users/jcs/org/blog/push-queue.org")
    (beginning-of-buffer)
    (if (search-forward-regexp "^\\* Ready to Post")
        (progn
          (forward-line)
          (org-end-of-item-list)
          (insert (format "- [ ] [[%s][%s]]\n" file (file-name-base file)))
          (org-update-statistics-cookies 'all))
      (error "Missing top-level header."))))

Now when I finish a post, I just type 【Meta+xjcs-add-to-push-queue (or really, thanks to smex, just a few letters of it) and push-queue.org is updated automatically. When I'm ready to publish a post I just click on the link to open the post in an Emacs buffer from which I can publish it directly to WordPress.

Footnotes:

1 The ORG-LIST-END-MARKER isn't really there. It appears to be an artifact of exporting a Org file from inside another Org file. Or something.

This entry was posted in General and tagged , . Bookmark the permalink.

One Response to Maintaining My Blog Post Queue

  1. Sacha Chua says:

    I like it - thanks for sharing! I've been using a huge Org outline file to manage more of my posts, both the ones in progress and the ones I'm ready to publish. Using Org headings for each of the posts makes it possible to use Scheduled and Deadline for reminders, I guess, although I haven't used that feature as much. Might be something to consider. =)

Comments are closed.