ox-hugo is an emacs plugin allowing the export of blog posts from an org-mode file to hugo.
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.
Thos properties has to be put on top of the org file.
Root of the Hugo folder.
Relative post folder.
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.
Categorie 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
** Create a blog with ox-hugo :blog: :PROPERTIES: :EXPORT_FILE_NAME: creation-blog-ox-hugo.fr.md :END:
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
#+HUGO_BASE_DIR: /home/david/hugo/ #+HUGO_SECTION: ./post/ #+author: Author * Emacs :@emacs: Emacs category ** Create a blog with ox-hugo :blog: :PROPERTIES: :EXPORT_FILE_NAME: creation-blog-ox-hugo.en.md :END: Post text