Org-mode and blogging

October 27, 2018

Blogging with Emacs and Org: One can find many posts on that specific topic, but here I just wanted to highlight how ox-hugo makes it so simple that you only need to have a single file to manage all your posts.

Note that this only applies to my micro posts. For standard posts like this one, I am still creating each new file via the command line using Hugo. This means that I will now have to write my posts using either Markdown (this post) or Org (micro posts), but that is not a big issue since I am quite comfortable with both markup language. Notice also that I published a few other posts on how I do manage this blog, but as you may have guessed my writing workflow is subject to intermittent changes.

So for now, rather than creating new micro posts using Hugo from the command line, I just have one Org file which basically looks like the one shown in the screenshot below:

Each post is written under a new level-2 heading, with basic PROPERTIES (actually, just the “slug”). The global settings are managed at the top of the file (see below), hence the fact that using a single file is much easier than one file per post, as discussed on the ox-hugo website. Here is my basic template:

#+STARTUP: content
#+HUGO_BASE_DIR: ~/Sites/aliquote/

Once your draft post is over, you just have to mark it as DONE (C-c C-t) and it got automatically “undrafted”. The published date will correspond to the timestamp created when switching the state of the post. Exporting as Markdown is managed via ox-hugo: in this case, C-c C-e H H anywhere in the post will export the post under the directory specified in the HUGO_SECTION option. Pretty simple for managing one-liner posts! A similar approach is used by Shane Sveller to publish his whole website.

On a related note, I initially came across one of the latest post by Jack Baty on Making org-journal more like Day One. There I learned about a nice feature for dragging and dropping external pictures right into an Org buffer, but more importantly this led me to learn about org-journal, and its dedicated layer for Spacemacs. How come I didn’t know that? Indeed, one could just use this approach to manage both a diary and micro posts since org-journal support entry tags. In addition, you can get an iCalendar version of your micro posts for free.

See Also

» On standardizing the use of Reminder App and Org mode » New tutorials » Spacemacs June 2018 » Setting Up Mu4e 1.0 C » Org and Bibtex