Skip to content

keelah-mt/ky-publish

Repository files navigation

Static site generator for Denote (Emacs/Org)

This is a Emacs package that given a Denote directory will generate a static site based on a (subset) of notes. Knowledge of Emacs, Org Export/Publishing and Denote is required to make use of it.

The package is very much a work in progress, but it is functional enough for me to use it on my personal site. If you want to see it in action and read more about the decisions/goals/tears behind this project, I have a post about it. It also happens to be my very first post. 😁

In an attempt to not be too opinionated, the package provides only a bare-bones Publishing backend derived from ox-html. Therefore all the stock styling and quirks of ox-html are included. On top of that the package includes a couple of transforms and hacks to make Denote links resolve properly when exported to HTML:

  • Every note, let’s say 20241224T204928--cooking__recipes.org is transformed in title/index.html directory under the site root. For our example it means that the post will be accessible under <site>/cooking URL.
  • Every file that is linked under denote: scheme but is not a page is treated as a site resource and is placed under /media directory.
  • For Denote files linked under file: scheme, only title part of the full name is used to generate links.
  • Dynamic resources generated by Org babel source blocks are supported too.
  • Anything else is not processed and behaves according to Org Publishing settings, i.e. controlled by org-export-with-broken-links setting.
  • Access to the precious notes is controlled by a special Denote keyword, any file without it is not published and links to them are set as broken, as per the point above.

That’s pretty much all of it. A small sample is included in ./test-blog. Note that for source blocks to work you need to have a proper setup with necessary dependencies. Even then I still haven’t managed to make them work in batch mode, outside my main Emacs configuration… Examples use Jupyter for Julia (as a kernel) and also a simpler Gnuplot example is included. The example can be built with ./build-test-blog.el. Apart from the requirements mentioned above it should be self-contained and should not mess with your Emacs setup too much.

The code comes with no guarantees! 💥 I use it for my personal needs. If you find it useful, I am happy and open to suggestions/requests, but it might take time.