Blogging with Org Mode and Hugo

Diego A. Mundo over at whyarethingsthewaytheyare.com has a nice post on how to blog with Hugo and Org mode. Hugo uses markdown as its input language but Mundo likes to work with Org so he wrote a bit of Elisp to export Org markup to markdown. That’s a nice bit of code because it shows how to use ox-pandoc to do the export. It serves as a handy go-by for automating other Pandoc translations from Org.

Mundo uses a single file for his blog with each post in a level 1 subtree. This is like the strategy that Artur Malabarba uses for Endless Parentheses. I like the single file idea a lot and would probably steal it except that I’m afraid a single file wouldn’t scale well with the daily posts that Irreal inflicts on the world.

As I’ve said many times, I’m a reasonably happy WordPress user but if I decided that I wanted a simpler homegrown method, Hugo and Org would be a something I’d definitely look at. You might think that you need to be an expert it do this type of thing but Mundo says he knows next to nothing about setting up a blog. He used Google Domains to register and maintain his domain and Gitlab Pages to host it. Everything else is contained in that single blog file and the bit of Elisp we wrote to turn his Org markup to a Hugo input file in markdown. Head on over to Mundo’s post for the details of how he set things up.

This entry was posted in General and tagged , . Bookmark the permalink.
  • According to https://github.com/spf13/hugo/releases/tag/v0.19, Org is now supported natively by Hugo. Maybe one doesn't have to convert Org to Markdown any more.

    • jcs

      Now that you mention it, I do remember seeing an announcement that Hugo now supported Org mode natively. Thanks for reminding me.

      Mundo's Elisp does more than just translate Org into markdown though. It also takes a "plain" Org file subtree and turns it into a proper Hugo input file. It's still very much worthwhile taking a look at his post.

      Also, as I said in the post, his Org mode to markdown code serves as an excellent go-by for using pandoc and Org together

  • gour_atmarama

    Let me add there is support for org-mode blogging in Nikola - https://getnikola.com/ static-site-generator via plugin - https://plugins.getnikola.com/v7/orgmode/ or via ox-export - https://github.com/masayuko/ox-nikola mechanism.

    • jcs

      Yes. I've written about blogging with Nikola and with Jekyll before. If you're an Org mode user, there are many blogging platforms that you can use.

  • sbrisard

    Hello there,
    for simple blogs, there is also the bare bones org-export solution: http://sbrisard.github.io/
    See https://github.com/sbrisard/blog/blob/master/sb-blog.el for configuration.

    • jcs

      Very nice. You've got a great looking blog with all aspects completely under your control.

  • Heikki Lehvaslaiho

    See https://github.com/masasam/emacs-easy-hugo that knows how write to hugo in org mode.

  • Kaushal Modi

    Shameless plug: ox-hugo is an Org exporter that exports whole files or Org subtrees to individual posts in Markdown for Hugo, with the required post front-matter. Here's the package website generated using ox-hugo itself :) https://ox-hugo.netlify.com/