Note created from Template with Templater not showing Properties

Hi,

I’m trying to use templator to dynamically insert the Date into the title (file name) of the note. But when I do this, for some reason all the property fields disappear. Does anyone know how to fix this?

This is my templater code:

    ---
    date: <% tp.date.now("YYYY-MM-DD") %>
    attendees: 
    ---
    <%*
    let currentDate = tp.date.now("YYYY-MM-DD");
    tp.file.rename("Meeting Note " + currentDate);
    %>

if you test it using Templater, you can see while it inserts today’s date in the file name/title, none of the property fields like date or attendees show up. How can i fix this?

Try without the leading spacing in the template note.

---
date: <% tp.date.now("YYYY-MM-DD") %>
attendees: 
---
<%*
let currentDate = tp.date.now("YYYY-MM-DD");
tp.file.rename("Meeting Note " + currentDate);
%>

Obsidian_npZBaeRMtu

1 Like

There was no leading spacing in the template note, its just how i accidently formatted it. Anyway i took a video of the template and the create a new note using template and I cannot replicate your video - as you can see, the Title of the meeting note is created properly, but the property fields are all missing. Is there something I missing here? And yes, before you ask, I do have Properties in document set as “visible” in my Editor settings.
https://www.youtube.com/watch?v=vj1Ly8bmy8w

Actually - what seems to happen is that it created a new file called Meeting Note 2025-04-15, and then it creates ANOTHER new file called Untitled with all the property fields inside that note. So it almost seems like it is creating 2 notes from that 1 template. Why is this happening?

Are you inserting the template into the template file? In the video, it doesn’t look as though a new file is being created.

What happens if you create a new blank file first and then insert the template into that?

So I found out the issue. If I press Alt+N (create a new note from templater hotkey), it does that behavior where it creates 2 notes, one with just the meeting title and the second note called Untitled with the property fields inside.

If I create a new note manually, and then press the hotkey binded to “Templater: Insert Templates/Meeting.md” (for me i set this to Ctrl+Alt+Shift+T), it does a slightly different behavior where it creates a new note with the title and property fields all correctly showing up, but the template is not inserted into the new note - the manually create note still exists.

If I create a new note manually, and then use the ribbon on the side and press the icon for templater and insert a template that way, it properly replaces the new note with the templated note and title/property fields.

Dont understand why this is happening. In an ideal world, I would just like to press 1 hotkey to automatically create a new note based on my templater template without double creating notes or other issues. Is that possible?

Hello.

I am sure it is possible, but I don’t use Templater, so I don’t know what to suggest.

I hope someone else can help.

EDIT: It appears to work without duplication in the example above given by @ariehen, so there must be a solution. :crossed_fingers:

Can anyone help me with this?

Adding await solved it on my iPhone:

---
date: <% tp.date.now("YYYY-MM-DD") %>
attendees: 
---
<%*
let currentDate = tp.date.now("YYYY-MM-DD");
await tp.file.rename("Meeting Note " + currentDate);
%>

I got the idea from Templater’s docs: https://silentvoid13.github.io/Templater/internal-functions/internal-modules/file-module.html#tpfilerenamenew_title-string