It may seem that, for the most part, I’ve been blogging about blogging. No matter how pointless it seems, I do think that this could prove useful to someone, in the same way I have benefited from others while setting up this site1.
One of the things I like about having an Octopress driven
txt-only blog is that I have the liberty to set things my way. The topic I am addressing here is that of writing blog posts on different devices2 with the help of Dropbox3 and Hazel. I’m still working out the whole remote blogging thing, this is but the first stage of a soon-to-be remote blogging workflow with Octopress.
My blog post writing workflow
Ideally any blog post starts with an idea that I write down in a text file named
runx-blog_ideas-qqq.txt4. This is done either on any of the two Macs using nvAlt or on my iOS device using any text editor5. I always write in Markdown (technically I mostly write in Multimarkdown, but that’s another thing).
After I decide that this idea is ready to become a draft, I create a text file that follows the same name convention for Octopress (
2012-10-14-Post-title.text) on a folder named
_drafts that resides in the
source. You might have noticed that the extension is not
.markdown and that is because I was having issues making Hazel read the contents of markdown files. So I opted for
.text which is technically the same as
.txt, but I would differentiate them as drafts and most importantly Hazel will be able to do its magic.
The underscore (
_) on the name of the drafts folder is so that it won’t be deployed, just as the posts folder
source/ |__ _drafts/ |__ _posts/
--- layout: post title: "Post title" date: 2012-10-14 23:28 author: Andres Marrugo comments: true published: false categories: [blog] ---
published: false, which means it is a draft. When I’m finished with the post I’ll change it to
The Syncing is done via Dropbox, because any iOS text editor comes with Dropbox support. iCloud has still a long way to go. Because my octopress folder does not reside in the Dropbox folder I made symlinks on my Mac to the
images folders so they get synced
ln -s ~/octopress/source/_posts/ ~/Dropbox/PlainText/blog/_posts ln -s ~/octopress/source/images/ ~/Dropbox/PlainText/blog/images ln -s ~/octopress/source/_drafts/ ~/Dropbox/PlainText/blog/_drafts
On any other machine they become actual folders.
Automating with Hazel
Ideally I would like to change the
published: false to
true and have it posted to my site, but it still requires some workarounds and this is why for the time being my hazel magic script only moves the file to the
_posts folder when the published option changes to
true. I then generate the site and deploy it manually, but this will soon be automated as well.
There are actually two Hazel rules for this. It first monitors the
_drafts folder for files whose content contains the phrase
published: true. When this happens the file gets moved to the folder
Then the second rule is for the
_posts folder. If the extension is
text (which means it was a draft that recently got moved) it will run a shell script.
The shell script is the following. What it does is to replace the date with the current date – you see, several days could’ve passed since I created the draft – in both the yaml header and the file name. And the other thing it does is to change the extension to
1 2 3 4 5 6 7 8
It may look like there’s not much automation, but if you think that this runs on my Mac while I’m writing it in my iPod Touch, then it gets really interesting, and the possibilities are almost infinite. Besides, updating the post date, moving files and changing extensions are quite tedious tasks by themselves. To make it automatically generate and deploy the site I’d have to add several more lines to the script, but I’m ok with how it is for now.
My Mac or my iPod touch.↩