reddit / emacs

Static site generator from org/roam

zuegg · 2022-11-05 07:59
Hi, I'm trying to generate a static site from all my org notes. The notes are currently a mix of plain org and org-roam notes and dailies. So far I've tried using `ox-hugo` to generate everything using this snippet (using doom emacs' doomscript): ``` (defcli! export-org (file) (require 'doom-start) ; load doom user config (with-current-buffer (find-file-noselect file) (setq org-hugo-base-dir "org-hugo-dir") (let ((org-id-extra-files (find-lisp-find-files org-roam-directory "\.org$"))) (org-hugo-export-wim-to-md)))) (run! "export-org" (cdr (member "--" argv))) ``` Basically I loop over all org files calling this script on each one, ox-hugo however fails with an error: ``` Error: [ox-hugo] my-file.org: The entire file is attempted to be exported, but it is missing the #+title keyword ``` Apparently ox-hugo requires at least a `#+title` property in every file... Problem is, I have hundreds of files and it would be quite tedious to add a title to every single one of them. So far I've considered these options: * I'm possibly missing some ox-hugo/hugo configuration * Programmatically adding #+title to every file * Switching to a different export mechanism altogether Any advice is greatly appreciated, thank you all!
lj-read-it · 2022-11-05 08:39
I love ```ox-hugo``` to bits, but its requirements can be quite specific and repurposing it to a large existing file may be fiddly. I wonder if Org Mode's native HTML export might work better? Here's [one writeup](https://systemcrafters.net/publishing-websites-with-org-mode/building-the-site/) on using it to publish a site.
zuegg · 2022-11-05 15:05
This is actually working, thanks! I got nothing fancy, but I can work on that with some simple styling it should provide a good starting point.
lj-read-it · 2022-11-05 16:34
Yay glad it works! There are a lot of styling options so I hope you can get it customized to your tastes :D