Create a blog with Hugo, Emacs and ox-hugo


Categories: emacs Tags: blog emacs orgmode hugo



ox-hugo is an emacs plugin allowing the export of blog posts from an org-mode file to hugo.

ox-hugo Installation

Add to you emacs configuration file (.emacs.d/init.el for example) the following use-package instruction :

      (use-package ox-hugo
        :ensure t
        :after ox)

Once ox-hugo is installed, the exporting fonctions will be available in the org-mode export menu.


Two publishing modes are available : using one org-mode file for each post, or using a global file.

In this post only the second mode will be described. Beside it’s the recommended way of using ox-hugo : using one file for each post requires copy-pasting all the global properties one each file.

Global properties

Thos properties has to be put on top of the org file.

Export folder

Root of the Hugo folder.

       #+HUGO_BASE_DIR: /home/hugo/


Relative post folder.

       #+HUGO_SECTION: ./post/


       #+author: Author

Post properties

With ox-hugo, each org-mode item can be exported to a post, if the post properties are filled in.

It’s possible to have a certain hierarchical element as a category. Hence every sub-item exported as a post will have a category assigned.

Category The syntax to assign a category to every sub-item is the following :

       * Emacs :@emacs:


In order to export an org item as a post, it is necessary to fill at least the EXPORT_FILE_NAME property.

       ** Create a blog with ox-hugo :blog:

Multilingual support

Once the desired languages are configured in hugo, you just have to insert the language code between the filename and its extension in the EXPORT_FILE_NAME property (i.e

Complete example

       #+HUGO_BASE_DIR: /home/david/hugo/
       #+HUGO_SECTION: ./post/
       #+author: Author

       * Emacs :@emacs:
       Emacs category

       ** Create a blog with ox-hugo :blog:
       Post text
>> Home