Hugo support for Doom Emacs
mituuz
Couldn’t find a working setup guide quickly, so decided to note this down.
ox-hugo is an org exporter for Hugo. Here’s how to setup and export a subtree using Doom Emacs 2.1.0.
Enabling ox-hugo for doom emacs
Seems like doom’s init.el once supported ox-hugo with lang:(org +hugo),
but that doesn’t seem to the case anymore.
Doom creates the following files. I enabled ox-hugo with these additions.
;; packages.el
(package! ox-hugo)
;; config.el
(after! ox
(require 'ox-hugo))
Then ran doom sync to finish setup.
Required configuration
ox-hugo requires the following configurations to work as expected.
I opted to create a .dir-locals.el file to my org directory, but there are other
options. For example globally or per file.
Base dir must point to the root of a Hugo project. Section is relative to the
content directory. hugo_root/content/posts/{exported_files}
((org-mode . (
(org-hugo-base-dir . "/path/to/hugo/repo")
(org-hugo-section . "posts")
)))
You must define a filename for the article so it can be exported.
:PROPERTIES:
:EXPORT_FILE_NAME: 2026-04-14_ox-hugo.md
:END:
Then you can export by using org-export-dispatch (C-c C-e). And selecting
Hugo compatible markdown, for example, H H exports the currently active
subtree.
Off you go
The documentation is good and clear so I won’t try to go deeper because I know nothing.