Blogging Process# Sat Nov 5, 2011 by brett
I have been meaning to blog more for ages. I have had a blog on the internet since early 1990 in one form or other, but I just tend to do sporadic blogging. Every so often I get fired up with communicating and write some blog posts, and then my enthusiam wanes for a while, and my writing tails off.
Throughout 2011 though, I have written a paragraph each and every day in my iPhone. Kind of a mini-diary. It’s been the longest period of regular writing that I have ever had. The factor that’s made me write regularly for so long is that I put a repeating reminder in my iPhone. At 4:45pm each day my phone rings a bell, which reminds me that I need to write down my Momento for the day.
Now I’m trying to apply this same technique to my blogging - setting aside a time to write, and writing a blog post each day.
I use Evernote to capture information throughout the day, especially interesting articles I read online. Within Safari, I can highlight the text I want to capture, press Cmd-C to copy it, and then press Ctrl-Cmd-V to paste it to a new note in Evernote. It’s fast, and it also saves the URL for attribution
Emacs - org-mode and markdown
When I’m ready to write, I start off by creating a directory to write in. In fact, I have an Emacs function that creates the directory for me, along with an org-mode file, and a markdown file. The org-mode file is where I write the skeleton of the post, and the markdown file is where I write the prose. Here is the emacs lisp code that sets me up for blogging:
- (defvar bh-blog-article-dir (expand-file-name "~/Dropbox/docs/blog-posts"))
- (defun bh-blog-article-start ()
- (let ((topic-name (read-string "Topic: "))
- (post-dir nil)
- (setq base-post-topic (mapconcat (function (lambda (x) x)) (split-string topic-name) "-"))
- (setq post-dir (concat bh-blog-article-dir "/" (format-time-string "%Y%m%d") "-" base-post-topic))
- (make-directory post-dir)
- (find-file (concat post-dir "/" base-post-topic ".org"))
- (find-file-other-window (concat post-dir "/" base-post-topic ".md"))
When a post is ready to be uploaded, I have a Python script that converts the markdown file to HTML format, extracts the first H1 heading in the HTML to use as the post title, and then uploads the post to my blog.