Blogging with Org-Mode and GNU Make
- The horrid one built in to
The inevitable outcome
Just as any sufficiently-complex C or Fortran program contains a slow, bug-ridden, informally-specified implementation of half of Common Lisp, I feel like the inevitable conclusion of the search for a static site generator means you end up just writing your own.
In my case, my criteria were simple.
- Small page size, ideally 100 kB or less including images, except for articles with many pics perhaps
- No docker or similar bullshit
- Ideally composable within org-mode
It turns out that nothing really meets these criteria except possibly
org export, which is built in to org-mode and is frankly awful. I'm a smart guy but I spent two days trying to figure out how to customize it to my liking and could not. The documentation is… lacking, to put it mildly.
Concatenating for fun and profit
I felt like my ideal case was having org mode shit out just an html snippet, i.e. not an entire web page, and then concatenating that with a header and footer that I would write myself. For the life of me I could not get this to work using org mode, so I turned to pandoc instead. My process is simple:
Write the article in org-mode, which allows explicit inclusion of html tags and elements where required.
Invoke Pandoc to translate org to html:
$ pandoc input.org -o output.html
Hand-craft a header and footer, concatenate all three together
$ cat header.html output.html footer.html
Rsync everything to a server.
$ rsync -a --delete staging/ [email protected]:/home/bla/path/to/www/
And that's it! I do this whole site via this method. The source code is available on github.