TIL: How to ignore files and folders in org-roam

Jan 22, 2025. 151 words. 1 minute. In TIL. emacs orgmode orgroam


tl;dr:An easy way to exclude certain files or folders from being included in the org-roam database, particularly useful for me with meta files, such as templates that have no unique id.

Today I learned a very simple way to exclude some files and/or folders from the org-roam database. I was facing errors from non-unique ids that were located in my templates (for org-capture and org-roam-capture). There it only says:

1
2
3
#+PROPERTIES:
:ID: %(org-id-new)
#+END:

That works great and creates a new unique id that will then be used by org-roam to index the note, but all templates will of course have the same ids. In practice, this does not create an issue, but as I was updating my template files a bit, I was annoyed at the warning message every time I saved one of the template files.

So, the solution came from this thread in the org-roam discourse group:

1
2
(setq org-roam-file-exclude-regexp
      (concat "^" (expand-file-name my-templates-directory))

And that’s it, just like this, the full folder is ignored and I do not get the warnings anymore.

Hope it helps!


Other posts related to this one: