Neil's Noodlemaps

Notes on my personal wiki config

Config stuff for org-roam and org-publish.

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=''>Recent changes</a>")
(setq commonplace/head-extra "<link rel='stylesheet' type='text/css' href='css/stylesheet.css'/>")

(setq org-publish-project-alist
         :components ("commonplace-notes" "commonplace-static"))
         :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"
         :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.

Appendix: Org Export - Org-roam

  (defun my/org-roam--backlinks-list (file)
  (if (org-roam--org-roam-file-p file)
       (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 "")
        (goto-char (point-max))
        (insert (concat "\n* Backlinks\n") links)))))

(add-hook 'org-export-before-processing-hook 'my/org-export-preprocessor)

3 .dir-locals.el

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.

See Configuration - Org-roam.

  (eval ngm-journal-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"))

5 Backlinks

Recent changes