Hugo Blogging With Org-Mode

· 529 words · 3 minute read

Tip

If you are not aware of org-mode and first time hear of it, I will try to make long story short and very simplified: it is a markup language used mainly by the community of emacs editor users. While org-mode is powerful, it is fairly geeky thing, so while by all means - feel free to check it out; but unless you have previous interest in org-mode topics, it is likely something you don’t want to spend time on. Take it as one of those things your “IT guys” in a company like…

It is not horribly loudly advertised feature, but Hugo blogging tool has native built-in support for org-mode It seems to be one of those features every remotely complex piece of software has, which you will not become aware of unless you've looked for it specifically, and in my case very actively.

While at the moment of writing this post this blog is mainly living based on markdown content, which is the main markup language of Hugo, I am a big fan of org-mode and am using it daily; mainly for agenda purposes.

How to set it up?

You don't have to. No, really.

org-mode support comes "out of the box" with Hugo, literally. It seems to be first class citizen in the Hugo ecosystem.

So, simply proceed and create your blog as you would do anyway, and that's it. No additional steps to take.

How to write content in org-mode syntax?

Again, it's really simple. There are few ways you can tell Hugo that your content is org-mode flavored, but the most straightforward is to simply name your content files with .org extension, and in them follow regular org-mode syntax.

Your metadata, instead of regular yaml/toml front matter, define regular front matter variables using Emacs variables on the top of the document.

So, where you would typically have something like this in markdown syntax:

categories = ["Development", "VIM"]
date = "2012-04-06"
description = "spf13-vim is a cross platform distribution of vim plugins and resources for Vim."
slug = "spf13-vim-3-0-release-and-new-website"
tags = [".vimrc", "plugins", "spf13-vim", "vim"]
title = "spf13-vim 3.0 release and new website"

With org-mode syntax, it would look like this:

#+CATEGORIES[]: Development, VIM
#+DATE: 2012-04-06
#+DESCRIPTION: spf13-vim is a cross platform distribution of vim plugins and resources for Vim.
#+SLUG: spf13-vim-3-0-release-and-new-website
#+TAGS[]: .vimrc, plugins, spf13-vim, vim
#+TITLE: spf13-vim 3.0 release and new website

In all other aspects, simply write your content using org-mode instead of the markdown syntax. It is really that easy if you already have life revolving in any aspect around org.

But… why?

I am really not an advocate for org-mode. On top of that, advantages of org-mode outside of advanced functionality of org-mode in Emacs (agenda, et. al.) are at best arguably usable if org-mode is used simply to render content into web pages and is not used for any interactivity.

This blog post by Karl Voit tries to summarize advantages of org-mode when used for markup only, but still YMMV.

But if you don't need convincing because you already spend part of your life revolving around org-mode, you might feel tempted to try Hugo as a blogging platform. 💪🏻