Resolving links with org2jekyll

In case anyone also wishes to publish their zettels with Jekyll, I am working to publish some of my notes with org2jekyll and here are my findings:

It seems that org-roam links do not work when org2jekyll publishes the roam node. It’s been noted that org2jekyll makes use of org-publish functions to complete the task.

Presently, org-publish resolves an ordinary [[file:title.org]] link to:

<a href="title.html">link description</a>

And the org-roam node link to:

<a href="title.html#ID-some-alpha-numeric-id-123">

Neither works out of the box.

I use the following set up (in config.el of Doom Emacs) to fix the problem.

;; Publish org-roam nodes with Jekyll.
;; Function to resolve org-roam links.

(defun org2jekyll-roam-link-export (link description format)
  "Export a man page link from Org files."
  (let ((desc (or description link))
        (file (file-name-base (car (org-roam-id-find link)))))

    (if (string= format "html")
        (format "<a href=\"../%s\">%s</a>" file desc)
      (org2jekyll-message "Unknown format %s, only dealing with html" format))))

(org-link-set-parameters "id"
                         :follow #'org-roam-id-open
                         :export #'org2jekyll-roam-link-export)
1 Like