content/blog/2026-08-11-orgo.org

orgo-post-subscripts
cleberg.net/content/blog/2026-08-11-orgo.org rendered · source · history · blame · raw

120 lines · 5562 bytes

  1#+date: [2026-08-11 Tue 20:51:00]
  2#+title: I Built My Own Org-Mode Static Site Generator
  3#+description: I was tired of bolting solutions onto my SSGs, so I built my own.
  4#+slug: orgo
  5#+filetags: :development:org-mode:
  6#+OPTIONS: ^:{}
  7
  8* Introducing: Orgo
  9
 10For a long time, I've been using [[https://github.com/emacs-love/weblorg][weblorg]], a static site generator (SSG) for
 11org-mode. It uses Emacs Lisp, which pairs well with Emacs. However, it has a few
 12downsides:
 13
 14- since it requires Emacs, the set-up and maintenance is heavy
 15- it has upstream dependencies that must also be installed and loaded into Emacs
 16- it re-runs the full process every time you need to regenerate the site, even
 17  if you only change a single character in one file
 18- since it runs through Emacs in the background, it takes quite a while to build
 19  my site (~180 pages)
 20
 21So, I decided to spin up my own org-mode-based SSG: [[https://gitbay.org/krz/orgo][orgo]]. This SSG uses org-mode
 22(rather than markdown) for its content.
 23
 24#+caption: The orgo CLI
 25#+attr_html: :alt Terminal output of orgo --help, listing the build, watch, serve, clean, audit, and init commands.
 26[[https://img.cleberg.net/blog/20260811-orgo/orgo.webp]]
 27
 28* Results Up Front
 29
 30I want to highlight the speed first, before I go into the major differences. As
 31you can see in the table below, orgo is incredibly fast.
 32
 33| Method                                 | Time  | Diff        |
 34|----------------------------------------+-------+-------------|
 35| weblorg (=emacs --script publish.el=)    | 49.0s |             |
 36| weblorg + [[https://gitbay.org/cmc/cleberg.net/blob/8ec9cdfeae71068a8924dd9f61b9cc28c947ec31/build.py][build.py]]                     | 50.3s |             |
 37| orgo, cold build                       | *0.22s* | 223× faster |
 38| orgo, nothing changed since last build | *0.13s* | 377× faster |
 39
 40Additionally, I added a few new features that weblorg didn't provide me:
 41
 42- Native features I used to build in Python post-weblorg:
 43  - Tag listings
 44  - Year separators on the blog page
 45  - RSS feed
 46  - Sitemap
 47  - Recent posts lists
 48- Syntax highlighting for 75 languages is supported, and you can drop in your
 49  own syntax definitions for anything missing.
 50- Builds are incremental. Only the pages whose content, config, or templates
 51  changed get re-rendered — adding a single post re-renders that post and the
 52  index that lists it, and nothing else.
 53- There is no Emacs, no package manager, and no runtime to install since orgo is
 54  a single binary.
 55
 56This results in a fast, clean, and simple SSG that stays out of my way instead
 57of requiring extensive set-up and maintenance.
 58
 59* What It Is Built On
 60
 61/Note: This section is for the nerds. Feel free to skip if you don't care about
 62the technology behind orgo./
 63
 64orgo is Rust, and it leans on a handful of well-worn crates rather than
 65reinventing them:
 66
 67- The org parser is hand-written, about 1,500 lines of it. There is no org-mode
 68  crate to lean on, and writing that parser is most of what writing an org SSG
 69  turns out to be.
 70- Templates run on [[https://crates.io/crates/minijinja][minijinja]], which speaks Jinja2. weblorg's templates are
 71  written for templatel, which is close enough that porting them was mostly a
 72  rename job.
 73- Syntax highlighting is [[https://crates.io/crates/syntect][syntect]], so the definitions and the themes are Sublime
 74  Text's. This site renders code with =InspiredGitHub=.
 75- Incremental builds hash the content, the config, and the templates with
 76  [[https://crates.io/crates/blake3][blake3]]. A page is re-rendered when its hash changes, and the manifest that
 77  remembers them is JSON sitting in the output directory.
 78- Pages render in parallel with [[https://crates.io/crates/rayon][rayon]], which is straightforward here because
 79  each page writes only its own file.
 80- The config is TOML, the CLI is [[https://crates.io/crates/clap][clap]], and =orgo serve= is [[https://crates.io/crates/notify][notify]] watching for
 81  edits with a [[https://crates.io/crates/tiny_http][tiny_http]] server in front of the output.
 82
 83* Getting Started
 84
 85If you use org-mode (or have been looking for a proper org-mode SSG), check it
 86out and let me know what you think.
 87
 88It's as simple as installing, initializing a new site, and serving it!
 89
 90#+begin_src shell
 91cargo install orgo
 92orgo init my-site
 93orgo serve my-site -o _site
 94#+end_src
 95
 96It can create a new project for you, adapt to your current org site, or simply
 97serve your folder of org-mode notes and files.
 98
 99Three more commands cover the rest of the day-to-day:
100
101- =orgo watch= rebuilds incrementally as files change, driven by filesystem
102  events, without serving anything. This is handy when something else is already
103  serving the output directory.
104- =orgo clean= removes the output directory, cache manifest and all, for when you
105  want to start from scratch.
106- =orgo audit= reports which org constructs a folder actually uses, and marks the
107  ones it doesn't handle.
108
109#+caption: An orgo Audit Report
110#+attr_html: :alt Terminal output of orgo audit, tallying every org construct in a corpus by frequency and marking each one in or out of scope, followed by counts of keywords, block types, drawers, and link schemes.
111[[https://img.cleberg.net/blog/20260811-orgo/audit.webp]]
112
113* The Future
114
115I'll be looking into making some built-in themes soon and exploring other
116features that make it a bit more seamless, as well as adopting to various
117methods different users may expect it to work.
118
119If you have any suggestions, reach out and let me know or open an issue/PR on
120GitBay!