I dug a little deeper by going through the code. I don’t think this is documented, but reading the code, I have realized that you can use a function name instead of a string. So this below works. (If you are interested in where to look, it’s function org-roam-capture--fill-template
).
(setq org-roam-capture-templates
'(("t" "technology" plain "** %?" ;; <= New notes in H2
:target (file+head+olp my/get-note-file-name ;; <= file name
my/get-tech-head ;; <= head (only once for file)
("Note")) ;; H1
:unnarrowed t)))
(defun my/get-note-file-name ()
(with-temp-buffer
(insert-file "~/Documents/temp/filename.org")
(buffer-substring-no-properties (point-min) (point-max))))
(defun my/get-tech-head ()
(with-temp-buffer
(insert-file "~/Documents/temp/head.org")
(buffer-substring-no-properties (point-min) (point-max))))
~/Documents/temp/filename.org
%<%Y%m%d%H%M%S>-${slug}.org
~/Documents/temp/head.org
#+title: ${title}
#+author: Name
* Note
:properties:
:CATEGORY: notes
:end: