Need Help Configuring Org-Roam for Different Directories

"First and foremost, I kindly request your patience as I am new to Emacs and its extensions, especially Org-roam. Before I proceed, let me explain something.

I have created a directory system for my notes, where:
~/Org/
├── 01_Diary/
├── 02_Compendium/
├── 03_Projects/
├── 04_References/
└── 99_Resources/

  1. 01_Diary: This directory is for daily journal entries, one note for each day.
  2. 02_Compendium: This directory can contain notes about personal ideas, thoughts, to-do lists, and more.
  3. 03_Projects: Notes related to specific projects I’m working on. Each project can have its own subdirectory.
  4. 04_References: This directory can contain notes about articles, books, or any other reference materials.
  5. 99_Resources: This directory can hold any additional resources you might need, such as note templates, scripts, etc.

I have managed to configure the directory settings for “01_Diary” in Org-Roam, and it’s working perfectly, as shown below:

;; Diary Notes Configuration
(defvar org-roam-dailies-directory)
(defvar org-roam-dailies-capture-templates)
(setq org-roam-dailies-directory "01_Diary/")
(setq org-roam-dailies-capture-templates
      '(("d" "default" entry
         "* %?"
         :target (file+head "%<%Y-%m-%d>.org"
                            "#+title: %<%Y-%m-%d>\n"))))

Currently, I am facing an issue that I can’t resolve. When I use the “M-x org-roam-capture” command, it creates a note in the main directory “~/Org” when I actually want it to be created and saved in the “02_Compendium” directory. Here’s the code I’m using:

;; Compendium Notes Configuration
(setq org-roam-capture-templates
      '(("c" "Compêndio" plain (function org-roam--capture-get-point)
         "%?"
         :file-name "02_Compendium/%<%Y%m%d%H%M%S>-${slug}"
         :head "#+title: ${title}\n"
         :unnarrowed t)))

I’m struggling to resolve this issue. Could you please help me?"

Three things stand out to me:

  1. Org-roam templates do not support :file-name property. Use :target, like your daily template

  2. :head is part of :target property, not a property on its own. Refer to your own daily template, which uses the correct syntax

  3. (function org-roam--capture-get-point) I don’t know if calling a function like this within a template works. And I am not sure if it is needed. Consider removing it first to get the basics working (and try adding it later)

I suggest to start with the default template and change it for one thing first. When this small change works, add another change. I also suggest to read the template walk-through in the user manual.

1 Like

Hello,

I would like to express my gratitude for your assistance. Thanks to your contribution, I was able to solve the issue, and now everything works just as I had envisioned.

The tips you shared were extremely valuable and enlightening. I appreciate you for pointing out the three important points that I needed to better understand. Your explanations were straightforward and truly helped me overcome the obstacles I was facing.

I will follow your advice to start with the default template and make changes gradually, step by step. I will also consult the user manual for a deeper understanding.

Once again, thank you for your contribution and your patience in answering my questions. Your assistance made all the difference, and I am very grateful for it.

May God always illuminate your path!

1 Like