ox-hugo

x-hugo is an Org Mode exporter backend that exports Org to hugo_server compatible Markdown (Blackfriday) and also generates the front-matter (in TOML or YAML format). I currently use it for Org Roam .

Once every org file is edited, org-hugo-export-to-md function is called to generate an equivalent markdown file. This exports current buffer to a Hugo-compatible Markdown file.

As you make changes in your post, save and do C-c C-e H H (or) C-c C-e H A to see the post update in the browser.

Additional options enabled here in this package:

Auto-export on Saving

Hugo-rendered post can be updated each time you saved your post in Org by Auto-export instead of running the above org-hugo-export-to-md function .

Enable for the whole project

To enable auto-exporting for the whole project, add this to the .dir-locals.el file in the project root:

prabu@homepc2 /d/d/p/D/org> cat /data/docs/prabu/Dropbox/org/.dir-locals.el
(("Resources/"
  . ((org-mode . ((eval . (org-hugo-auto-export-mode)))))))

an alternate export script to run from scratch buffer with M-x eval-region

(let ((org-export-with-broken-links t)) ; This tells Emacs "Export anyway"
  (dolist (file (directory-files-recursively "/data/myhome/prabu/Dropbox/org/Resources" "\\.org$"))
    (with-current-buffer (find-file-noselect file)
      (hack-local-variables)
      (message "[build] Attempting: %s" file)
      (condition-case err
          (org-hugo-export-wim-to-md)
        (error (message "[build] Failed %s: %s" file err)))
      (kill-buffer))))

© Prabu Anand K 2020-2026