Capture Template only partially applied

Hello,

I defined a capture template to create a new entry from my browser. Everything works fine except that some of the properties defined in the head section are missing. I only get #+TITLE: and #+roam_key:. Everything else is missing. Is my configuration correct or am I running into a bug here?

This is my configuration

  (use-package org-roam
    :hook
    (after-init . org-roam-mode)
    :custom
    (org-roam-directory "~/Nextcloud/org/roam")
    :bind (:map org-roam-mode-map
		(("C-c n l" . org-roam)
		 ("C-c n f" . org-roam-find-file)
		 ("C-c n g" . org-roam-show-graph))
		:map org-mode-map
		(("C-c n i" . org-roam-insert)))
    :config
    (setq org-roam-ref-capture-templates
	  '(("r" "ref" plain (function org-roam-capture--get-point)
	     "%?"
	     :file-name "websites/${slug}"
	     :head "#+TITLE: ${title}\n#+roam_key: ${ref}\n#+HUGO_SLUG: ${slug}\n#+roam_tags: website\n#+title: ${title}\n\n- source :: ${ref}\n"
	     :unnarrowed t)))

Does anyone have an idea why this is happening?

Thank you very much

You’re modifying the wrong variable. For protocol-templates, you need to modify org-roam-capture-ref-templates (notice the ref).

For example…

(setq org-roam-capture-ref-templates
      '(("r" "ref" plain (function org-roam-capture--get-point)
         "%?"
         :file-name "web/${slug}"
         :head "#+TITLE: ${title}
#+ROAM_KEY: ${ref}
#+ROAM_ALIAS:
#+ROAM_TAGS:
#+CREATED: %u
#+LAST_MODIFIED: %U
- source :: ${ref}\n\n"
         :unnarrowed t)))

Thank you for the clarification!
I looked at some other configuration https://github.com/jethrokuan/dots/blob/master/.doom.d/config.el#L462 and it seems the correct variable is org-roam-capture-ref-templates and not org-roam-ref-capture-templates.

I hope the person whose config I used is probably having the same issue…

Thanks!

Yes :smiley: that would be me, I’d changed it but didn’t push the updates up.

2 Likes