Templater + Daily Note = Odd

I have installed and enabled Templater, and also enabled Daily Note.

As a test, I created a template in my template folder that looks like this:

<% tp.file.creation_date() %>

[[Dailies/<% tp.date.now(“YYYY-MM-DD”, -1) %>]] | [[ Dailies/<% tp.date.now(“YYYY-MM-DD”, 1) %>]]

If I open a note and insert this template, it comes out as I would expect:

2021-09-06 21:04

[[Dailies/2021-09-05]] | [[ Dailies/2021-09-07]]

However, if I use this template for the daily note and create the daily note, it is NOT what I expect:

<% tp.file.creation_date() %>

[[Dailies/<% tp.date.now(“YYYY-MM-DD”, -1) %>]] | [[ Dailies/<% tp.date.now(“YYYY-MM-DD”, 1) %>]]

I am certain I’ve done something dumb and that’s why it’s not working, but, as is the nature of dumb things, I can’t figure out what it is. Can anyone here shed some light on this for me?

Thanks!

Problems getting Templater Plugin working

This may help you.

Perhaps the creation date is not available in the second case. Try this from my daily note template:

<%tp.file.title%>

[[Dailies/<%tp.date.now("YYYY-MM-DD", -1, tp.file.title, "YYYY-MM-DD") %>]] | [[Dailies/<% tp.date.now("YYYY-MM-DD", 1, tp.file.title, "YYYY-MM-DD") %>]]

This has the added benefit of emiting the correct links if you ever create a daily note on a day different than the note itself (e.g. creating tomorrow’s note ahead of time)

I tried this and received the same kind of output: The contents of the template were inserted into the new note, but it looks like Templater never had the chance to interpret them.

I looked at this. I am using the command from the command pallette ‘Daily Notes: Open Today’s Daily Note’ during testing to trigger today’s daily note. When I trigger the template on its own, I do use the Templater command: Templater: Insert Template.

If the intent is to say that the Daily Notes plugin doesn’t interact with Templater and I should add the template after the fact, I could do that but I was hoping to understand why I would need to.

Maybe you forgot to enable the Trigger Templater on new file creation option.

I knew it was dumb! Thank you very much!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.