Publishing notes, static site generation with Org-roam

I’d like to publish some of my Org-roam nodes (those with :publish: true in the properties drawer or something like that).

This would be part of a more complex website, but I’d start off with just the nodes.

I’ve see Ox-Hugo, Quartz, Hakyll, and Org-publish mentioned in posts, but I’m unsure how well these would fare with Org-roam specifically, as opposed to vanilla Org-mode.

I’d prefer to use Org-publish, but would be willing to try another tool if it is not suited to Org-roam.

Any pointers? What are other people using?

I do this. There’s the following passage in my .emacs file:

(setq org-roam-capture-templates
      '( ("u" "public" plain "%?"
          :if-new (file+head "public/${slug}.org"
                             "#+title: ${title}\n")
          :unnarrowed t)
	 ("r" "personal" plain "%?"
          :if-new (file+head "personal/${slug}.org"
                             "#+title: ${title}\n")
          :unnarrowed t)
          ;; and a few more
	 ))

When I make a new note, org-roam asks me what repo to put it in. That selection is only a single keystroke – “u” is for public, “r” is for personal, etc. The public repo is one that I publish on github publicly, whereas personal is private.

Oh but that’s only half of your problem. You also want the public notes to be navigable, right? For that I wrote some code:

It reads your data and writes a copy to empty folders you specify where the links have been changed from org-roam links, which GitHub doesn’t understand, to Github style file-and-anchor links. A user online can thus follow links. They can’t see backlinks, though.

OK thank you, that is helpful. I’d prefer to have everything in the same folder and then use Org properties drawer to differentiate, but I think I can write some code for that.

Where do you think I would write that code though? Would I extend the static site generator itself, or do something in Emacs Lisp?

Alternatively, I could write my own code in a different language to generate a set of files that I want to publish, and then pass those files to a static site generator like Ox-Hugo. This is what I am leaning towards now.

With your repo, I think it would not be for me because I want to host on my own webserver not GitHub, but I may be misunderstanding what your code does. Does it do static site generation too, or use an existing program for this?

I came across this from 5 years ago that uses Org-publish and does generate backlinks, although the code is quite complex and would probably need a lot of modifying on my end.