Installation

This package requires emacs 24.5+ and Org 9.0+. It is available on Melpa (https://melpa.org/#/ox-hugo).

Usage Once the package is installed, you will need to require it so that the ox-hugo export options are available in the Org Export Dispatcher menu (the one you see when you hit C-c C-e to initiate any export).

You can do that by adding the below to your config:

(with-eval-after-load 'ox (require 'ox-hugo)) If you use use-package, you can do the below instead:

(use-package ox-hugo :after ox) Spacemacs

Spacemacs users can choose to add this snippet to their dotspacemacs/user-config function in .spacemacs:

(defun dotspacemacs/user-config () ;; Other stuff ;; ..

;; ox-hugo config (use-package ox-hugo :ensure t ;Auto-install the package from Melpa :after ox)) If you do so, you also need to add ox-hugo to dotspacemacs-additional-packages.

Verified to work on Spacemacs develop branch with spacemacs-base distribution, emacs editing style.

Before you export Before you export check that these properties are set as you need:

HUGO_SECTION: The default Hugo section name for all the posts. See here for more information on Hugo sections. It is common for this property to be set to posts or blog. The default value is set using org-hugo-default-section-directory. HUGO_BASE_DIR: Root directory of the source for the Hugo site. If this is set to ~/hugo/, the exported Markdown files will be saved to ~/hugo/content/<HUGO_SECTION>/ directory. By default, the Markdown files reside in a hierarchy under the content/ directory in the site root directory (ref). If you try to export without setting this property, you will get this error:

user-error: It is mandatory to set the HUGO_BASE_DIR property Important: If you choose to export an Org subtree as a post, you need to set the EXPORT_FILE_NAME subtree property. That property is used by this package to figure out where the current post starts.