Last year, while looking for ways to create a blog using Org-mode, I ran across ox-hugo. It was clever, but I was uncomfortable with yet another layer of abstration between the source text and the rendered HTML. I may have gotten over that fear.
I’m slowly standardizing on using org-mode files for all of my writing. I’ll hate myself for this if I ever decide to stop using Emacs, but I’ll deal with that then.
Ox-hugo works via the standard org-mode export dispatcher. The result is rendered as a normal Hugo Markdown file. This means that if I decide to stop using Org-mode for blog posts, or even move to another markdown-based site builder, all of my posts are still there and usable as-is.
Another nice feature is that all of my posts are in a single org-mode file, one
subtree per post. I like this because I don’t have to create a
properly-formatted markdown file in a specific folder in order to create a post.
I just set the
EXPORT_FILE_NAME property and ox-hugo takes in from there.
Of course I’m using a handy capture template, as provided by the ox-hugo docs.
This lets me type
C-c c h to quickly create a new draft post.
All subtrees marked as
TODO are considered to be drafts. Toggling the
DONE sets “draft = false” and also sets the publish date to the
Tags are set just like normal org headings (e.g. “tag1:tag2”).
Being able to directly publish to my Hugo-based blog while still living in an Org-mode is pretty sweet.