1 org-publish config
My config for org-publish.
(require 'ox-publish) (setq commonplace/project-dir "/home/shared/commonplace/") (setq commonplace/publish-dir "/var/www/html/commonplace/") (setq commonplace/preamble "<div><a href='/'>Neil's Noodlemaps</a></div>") (setq commonplace/postamble "<a href='https://gitlab.com/ngm/commonplace/activity'>Recent changes</a>") (setq commonplace/head-extra "<link rel='stylesheet' type='text/css' href='css/stylesheet.css'/>") (setq org-publish-project-alist `(("commonplace" :components ("commonplace-notes" "commonplace-static")) ("commonplace-notes" :base-directory ,commonplace/project-dir :base-extension "org" :publishing-directory ,commonplace/publish-dir :publishing-function org-html-publish-to-html :recursive t :headline-levels 4 :with-toc nil :html-doctype "html5" :html-html5-fancy t :html-preamble ,commonplace/preamble :html-postamble ,commonplace/postamble :html-head-include-scripts nil :html-head-include-default-style nil :html-head-extra ,commonplace/head-extra :htmlized-source t :auto-sitemap t :sitemap-title "All pages" ) ("commonplace-static" :base-directory ,commonplace/project-dir :base-extension "css\\|js\\|png\\|jpg\\|gif" :publishing-directory ,commonplace/publish-dir :recursive t :publishing-function org-publish-attachment)))
2 Including backlinks during org-publish
This is great - it makes the published version a lot more navigable and closer to what's going on inside org-roam when you're in Emacs.
(defun my/org-roam--backlinks-list (file) (if (org-roam--org-roam-file-p file) (--reduce-from (concat acc (format "- [[file:%s][%s]]\n" (file-relative-name (car it) org-roam-directory) (org-roam--get-title-or-slug (car it)))) "" (org-roam-sql [:select [file-from] :from file-links :where (= file-to $s1)] file)) "")) (defun my/org-export-preprocessor (backend) (let ((links (my/org-roam--backlinks-list (buffer-file-name)))) (unless (string= links "") (save-excursion (goto-char (point-max)) (insert (concat "\n* Backlinks\n") links))))) (add-hook 'org-export-before-processing-hook 'my/org-export-preprocessor)
I have a separate work knowledgebase using org-roam, but occassionally at work I also want to add something into my personal knowledgebase. So having the org-roam-directory set in the org-roam layer isn't enough. I've set a directory local variable for the org-roam personal wiki directory to use.
((nil (eval ngm-journal-mode)) (org-mode (org-roam-directory . "/home/shared/commonplace/")))
4 Hiding certain nodes from the graph
Handy for me to exclude the sitemap that I have generated by org-publish, and the home page. They confuse the node map a bit.
(setq org-roam-graph-exclude-matcher '("sitemap" "index"))