# Need help with org-roam-dailies-capture-template

**URL:** <https://org-roam.discourse.group/t/need-help-with-org-roam-dailies-capture-template/2882>\
**Category:** Troubleshooting\
**Created:** [December 2, 2022, 7:50am UTC](https://org-roam.discourse.group/t/need-help-with-org-roam-dailies-capture-template/2882 "2022-12-02T07:50:11Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![vikas.mishra](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/vikas.mishra/32/1125_2.png) [@vikas.mishra](https://org-roam.discourse.group/u/vikas.mishra)\
**Post date:** [December 2, 2022, 7:50am UTC](https://org-roam.discourse.group/t/need-help-with-org-roam-dailies-capture-template/2882/1 "2022-12-02T07:50:11Z")

</div>

Hello

I am trying to debug a dailies capture template. Here is what I am trying to achieve, I want to create a Dailies template that looks like below when the dailies note doesn’t exist. This is working for me.

```auto
#+TITLE: 2022-12-07
#+FILETAGS: daily

* Focus
* Tasks
* Journal

```

When I try to capture in a note that exists, I want to add a timestamp and a second level heading below journal but that’s not working for me. Here is my setup

```lisp
(setq org-roam-dailies-capture-templates
        '(("d" "default" entry "* %<%I:%M %p>: %?"
           :target (file+head "%<%Y-%m-%d>.org" "Journal")
           :if-new (file+head "%<%Y-%m-%d>.org"
                              "#+TITLE: %<%Y-%m-%d>\n#+FILETAGS: daily\n\n* Focus\n\n* Tasks\n\n* Journal")
           :unnarrowed t)))

```

My assumption is that on the line `:target (file+head "%<%Y-%m-%d>.org" "Journal")` , this should search for a Level 1 Heading called Journal and create a sub entry below this. , But it doesn’t do that. Here is what I get.

```auto
#+TITLE: 2022-12-07
#+FILETAGS: daily

* Focus

* Tasks

* Journal
* 01:19 PM: Let's create a timed log here.

```

Noticed how the time stamped entry is still at Level 1. Any hints on what I am doing wrong will really help.

Thanks,  
Vikas

---

<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:** [December 2, 2022, 8:05pm UTC](https://org-roam.discourse.group/t/need-help-with-org-roam-dailies-capture-template/2882/2 "2022-12-02T20:05:13Z")

</div>

> [@vikas.mishra](#):
>
> `"* %<%I:%M %p>: %?"`

Perhaps add another star ”\*”?

---

<div class="post-metadata">

**Author:** ![vikas.mishra](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/vikas.mishra/32/1125_2.png) [@vikas.mishra](https://org-roam.discourse.group/u/vikas.mishra)\
**Post date:** [December 3, 2022, 2:24am UTC](https://org-roam.discourse.group/t/need-help-with-org-roam-dailies-capture-template/2882/3 "2022-12-03T02:24:09Z")

</div>

I had forgotten to mention that in my post earlier. I had already tried with an extra '\*` didn’t seem to make a difference.

 ![broken_capture](https://global.discourse-cdn.com/free1/uploads/orgroam/original/2X/f/facba2554ac25668dae4130b08cd6be28aaa1d19.jpeg)

---

<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:** [December 3, 2022, 8:09am UTC](https://org-roam.discourse.group/t/need-help-with-org-roam-dailies-capture-template/2882/4 "2022-12-03T08:09:20Z")

</div>

I think what you are going for is something like this:

```auto
(setq org-roam-dailies-capture-templates
        '(("d" "default" entry "** %<%I:%M %p>: %?"
           :target (file+head+olp "%<%Y-%m-%d>.org"
                                  "#+TITLE: %<%Y-%m-%d>\n#+FILETAGS: daily\n\n* Focus\n\n* Tasks\n\n* Journal"
                                  ("Journal"))
           :unnarrowed t)))

```

I only tested it lightly but seems to work.

I don’t think `:if-new` is meant to be used “in addition” to `:target` – the former is the replacement of the latter and does not mean “If the new note is being created, use A; if not, use target”. I don’t know why two stars didn’t work, though.

---

<div class="post-metadata">

**Author:** ![vikas.mishra](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/vikas.mishra/32/1125_2.png) [@vikas.mishra](https://org-roam.discourse.group/u/vikas.mishra)\
**Post date:** [December 3, 2022, 11:38am UTC](https://org-roam.discourse.group/t/need-help-with-org-roam-dailies-capture-template/2882/5 "2022-12-03T11:38:19Z")

</div>

That did work - thank you very much.  
I didn’t realize that `:if-new` and `:target` are not meant to be used together. I had interpreted it to mean exactly what you said. I didn’t realize that `:target` had superseded `:if-new`.

Appreciate the help.

---

<div class="post-metadata">

**Author:** ![ChuckSneed](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/chucksneed/32/1379_2.png) [@ChuckSneed](https://org-roam.discourse.group/u/ChuckSneed)\
**Post date:** [December 1, 2023, 12:03pm UTC](https://org-roam.discourse.group/t/need-help-with-org-roam-dailies-capture-template/2882/6 "2023-12-01T12:03:54Z")

</div>

> [@nobiot](#):
>
> the former is the replacement of the latter

If that’s the case should we use `:if-new` instead of `:target`? But then, in your examples in this thread, you use `:target`. I am confused by your statement. Also, I am having trouble in understanding the functionality-wise difference between `:if-new` and `:target`.

---

<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:** [December 1, 2023, 3:29pm UTC](https://org-roam.discourse.group/t/need-help-with-org-roam-dailies-capture-template/2882/7 "2023-12-01T15:29:02Z")

</div>

I think this would have been a mis-statement on my part. My understanding is that they function in the same way, but :target replaces :if-new. I use :target. I believe you can confirm which is the current by looking at the doc string of org-roam-templates.
