How to add another template and set it as default?

I am very new to org-roam (and quite new to emacs), so please forgive my ignorance.
I want to add another template (which adds some more lines to the header), and set it as default.
How can I do that? I saw the example in the docs, but it does not explain this (as far as I’ve understood).

You need to modify the variable org-roam-capture-templates:

(setq org-roam-capture-templates
      '(("d" "default" plain
         (function org-roam-capture--get-point)
         "%?"
         :file-name "%<%Y%m%d%H%M%S>-${slug}"
         :head "#+TITLE: ${title}\n#+CREATED: %U\n#+LAST_MODIFIED: %U\n\n"
         :unnarrowed t)
        ("D" "default copy" plain
         (function org-roam-capture--get-point)
         "%?"
         :file-name "%<%Y%m%d%H%M%S>-${slug}"
         :head "#+TITLE: ${title}\n#+CREATED: %U\n#+LAST_MODIFIED: %U\n\n"
         :unnarrowed t)))
4 Likes

Why would we need two identical templates?

It was a proof of concept to illustrate my point.

1 Like

Ok thanks. Just to be sure :wink:

Hi,

I’m just starting with org-roam and I wanted the notes to have the title first in their name.

For such a modification, I tried the suggestion from @zaeph (copy pasting it into my .emacs), however when I use org-roam-node-find to create a new node I keep getting the following message in the minibuffer:

“Template needs to specify ‘:target’”

Just in case it helps, this is the set up I have for org-roam:


;;; Set up Org-roam
(setq org-directory (concat (getenv "HOME") "/notes/"))
(use-package org-roam
  :after org
  :init (setq org-roam-v2-ack t) ;; Acknowledge V2 upgrade
  :custom
  (org-roam-directory (file-truename org-directory))
  :config
  (org-roam-setup)
  :bind (("C-c n f" . org-roam-node-find)
	 ("C-c n r" . org-roam-node-random)		    
	 (:map org-mode-map
	       (("C-c n i" . org-roam-node-insert)
		("C-c n o" . org-id-get-create)
		("C-c n t" . org-roam-tag-add)
		("C-c n a" . org-roam-alias-add)
		("C-c n l" . org-roam-buffer-toggle)))))

Where are your templates?
It looks like the example by zaeph above were for v1 and no longer valid.

Thanks for the quick response! I don’t have any templates of my own. I thought I could simply make some small changes following the example above. If I do need templates, could you point me to somewhere explaining this? The org-roam manual is very detailed but I get lost there and I didn’t find how to do the small changes I want. As these are small things, I can also live without them, though.

I refer to the default one (C-h v org-roam-capture-templates) and adjust it. My change to the templates is very light, too, so I don’t know any good explanation.

Maybe this? (I haven’t read it but I only hear good things about System Crafters on Org-roam and Emacs tutorials):

https://systemcrafters.net/build-a-second-brain-in-emacs/capturing-notes-efficiently/

1 Like