# Define org-roam-dailies-capture-templates content in files, not string literals

**URL:** <https://org-roam.discourse.group/t/define-org-roam-dailies-capture-templates-content-in-files-not-string-literals/3234>\
**Category:** Troubleshooting\
**Created:** [September 17, 2023, 4:19pm UTC](https://org-roam.discourse.group/t/define-org-roam-dailies-capture-templates-content-in-files-not-string-literals/3234 "2023-09-17T16:19:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jml](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/jml/32/1153_2.png) [@jml](https://org-roam.discourse.group/u/jml)\
**Post date:** [September 17, 2023, 4:19pm UTC](https://org-roam.discourse.group/t/define-org-roam-dailies-capture-templates-content-in-files-not-string-literals/3234/1 "2023-09-17T16:19:04Z")

</div>

Hello,

I’m trying to define my `org-roam-dailies-capture-template` in a file, rather than in a string.

Here’s my current set up, using a string, that works:

```auto
(use-package org-roam-dailies
  :after org-roam
  :ensure t
  :bind-keymap ("C-c n d" . org-roam-dailies-map)
  :config

  (setq org-roam-dailies-capture-templates
        '(("d" "default" plain "%?"
           :target (file+head "%<%Y-%m-%d>.org"
                              "#+title: %<%Y-%m-%d %A>\n")))))

```

If I change the last clause to

```auto
(setq org-roam-dailies-capture-templates
        '(("d" "default" plain (file "/path/to/my/template.org")
           :target (file "%<%Y-%m-%d>.org"))))

```

Then when I capture a daily (via `org-roam-dailies-goto-today`) I get a blank org-roam file with a properties file and no errors or anything interesting in the `*Messages*` buffer.

Relatedly, I’m also very confused by the relationship between the template string and the “head” content when using `file+head`.

I looked up [Dailies capture templates best practices](https://org-roam.discourse.group/t/dailies-capture-templates-best-practices/1043) before post this, but couldn’t connect the post & its replies to the problem I’m seeing.

My goal is to have an extended daily self-check in thing in my daily template.

I’m using `org-roam` version `20230307.1721`.

---

<div class="post-metadata">

**Author:** ![nobiot](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/nobiot/32/159_2.png) [@nobiot](https://org-roam.discourse.group/u/nobiot)\
**Post date:** [September 18, 2023, 4:40pm UTC](https://org-roam.discourse.group/t/define-org-roam-dailies-capture-templates-content-in-files-not-string-literals/3234/2 "2023-09-18T16:40:14Z")

</div>

I suggest you try `org-roam-dailies-capture-today` instead of `go-to-today`. You should immediately see a different behaviour. To test, I’d either change the name of the file for today, or delete it and start from scratch.

Somehow, it feels to me that `dailies-capture` is meant to be used to create a new journal file for the first thing in the day; `dailies-goto-today` is to navigate to the one you have already created to continue to work on it.

The `head` part of `file+head` is rather literally the “header” part of the file – so it is added once when the file is created. That’s why the title with the date is set there in the default (the default is one file per day, so the title aligns with this).

This default set up with `head` makes sense when you use `entry` instead of `plain` – because `entry` in this case is a headline in org’s parlance. The design is supposed to be that you would create a multiple entries (headline with text body) in the course of the day in the same one file – one head, multiple entries.

When you use `plain` instead of `entry`, you may not need `head` – but this depends on the content of your template file and your workflow for journaling.

Just to give you an example:

```plaintext
(setq org-roam-dailies-capture-templates
      '(("d" "default" entry "* This is an entry of the day \n%?" :target
	 (file+head "%<%Y-%m-%d>.org" "#+title: %<%Y-%m-%d>"))))

```

With this setup, if you do `org-roam-dailies-capture-today` you will get something like this below in the screen capture. With `entry`, the capture creates a new entry each time. See the first and second entries with the same heading “\* This is an entry of the day”. And the `head` adds the title only once, so the second and subsequent captures do not add a new title to the file each time – that should be what you want.

 ![image](https://global.discourse-cdn.com/free1/uploads/orgroam/original/2X/8/84f51a4e843742651f4fc497da78abd6c59e652e.png)

Now… You seem to prefer to use the template text file. That is a good method. But you might need to begin the file with a headline like my example if you use `entry`. Or alternatively, you might be happy with `plain` and get the whole file content to be added to your daily journal. This might work, but be careful. Because the whole file content will be added with **each capture** so you might repeat the title, etc. every time. If you see yourself calling `capture` many times a day, then you should consider `head` with `file+head`. Or use `plain` and define another capture template targeting at a specific headline, etc. This depends on your journaling workflow.

If you decide to use `head`, one more thing: I don’t think `head` accepts `file "dir/to/file"` syntax, so you would want to directly add the text in the capture-templates list.

I hope this makes sense.

– nobiot
