Skip to content

Latest commit

 

History

1,831 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ox-Zola

https://img.shields.io/badge/License-GPL%20v3-blue.svg

Ox-zola is an Org exporter backend that exports Org mode to Markdown with TOML frontmatter compatible with the Zola static site generator.

Drop-in replacement for ox-hugo when targeting Zola. If you’re migrating your blog from Hugo to Zola, you can keep your existing Org files with HUGO_* keywords unchanged! Just switch to ox-zola and your exports will produce Zola-compatible output.

Quick start

Configure your Zola site in your Emacs config:

(setq ox-zola-base-dir "~/my-zola-site")
(setq ox-zola-section "posts")  ; default section

Or configure per-file with keywords:

#+zola_base_dir: /path/to/your/zola/project
#+zola_section: posts

Write your posts as Org headings:

* My First Post
:PROPERTIES:
:EXPORT_FILE_NAME: my-first-post
:END:
This is my first post written in Org-mode!

Export with the Org export dispatcher (M-x org-export-dispatch or C-c C-e). The Zola backend appears under the Z key:

[Z] Export to Zola Markdown
    [z] Subtree or File to Md file            [Z] File to a temporary Md buffer
    [O] Subtree or File to Md file and open   [f] File to Md file
    [A] All subtrees (or File) to Md file(s)  [o] File to Md file and open

It builds on top of ox-hugo, so all ox-hugo features work: subtree exports, property inheritance, WIM detection, and more. See the ox-hugo documentation for the full feature set.

Adding taxonomies

Use Org tags for taxonomies:

* My First Post :@blogging:emacs:

This creates a category blogging and a tag emacs.

Or use file-level keywords:

#+zola_categories: blogging
#+zola_tags: emacs org-mode

Both produce proper Zola frontmatter:

[taxonomies]
categories = ["blogging"]
tags = ["emacs", "org-mode"]

Page bundles

To create a page bundle with assets in the same directory:

* My First Post :@blogging:emacs:
:PROPERTIES:
:EXPORT_HUGO_SECTION: posts/my-first-post
:EXPORT_FILE_NAME: index
:END:

Migrating from Hugo to Zola

If you’re switching your blog from Hugo to Zola:

  1. Keep your existing Org files - HUGO_* keywords work unchanged
  2. Replace your config:
    ;; Before (ox-hugo)
    (require 'ox-hugo)
    (setq org-hugo-base-dir "~/blog")
    
    ;; After (ox-zola)
    (require 'ox-zola)
    (setq ox-zola-base-dir "~/blog")
        
  3. Use ox-zola-export-* instead of org-hugo-export-*

ox-zola automatically transforms the output for Zola:

ox-hugo (Hugo)ox-zola (Zola)
tags = [...] at root[taxonomies] section
lastmodupdated
layouttemplate
{{< shortcode >}}{{ shortcode() }}
relref shortcodes@/ path syntax

If you have different websites generated with Zola and Hugo, you’re covered. ox-zola doesn’t break ox-hugo: both can coexist!

Installation

With Straight

(use-package ox-zola
  :straight (ox-zola :host github :repo "gicrisf/ox-zola"))

With built-in :vc (Emacs 29+)

(use-package ox-zola
  :vc (:url "https://github.com/gicrisf/ox-zola"
            :rev :newest
            :branch "main"))

With Doom

In ~/.config/doom/packages.el:

(package! ox-zola :recipe (:host github :repo "gicrisf/ox-zola"))

In ~/.config/doom/config.el:

(use-package! ox-zola)

Then run doom sync.

Donate

Did you find this package useful? Buy me a coffee!

https://ko-fi.com/img/githubbutton_sm.svg

License

Open sourced under the GPL-3.0 license.

About

A carefully crafted Org exporter back-end for Zola

Resources

Stars

61 stars

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages