Couple of tweaks for org-publish backlinks function

After updating to 1.2.3 I noticed that my backlinks weren’t publishing during org-publish, using the org-roam--backlinks-list example function that was in the org-roam docs back in the day (which no longer seems to be there.)

Couple of updates required:

So the tweaked function I’m using now is:

(defun commonplace/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-db--get-title (car it))))
       "" (org-roam-db-query [:select [source] :from links :where (= dest $s1)] file))
    ""))

I noticed here that @jethro has a slightly different function for this, so the general use of elisp there is probably better.

I no longer generate backlinks using Org-roam’s db: i just use Hugo’s templating functionality.