Templater create new note from template replace file name

Hello,

I created a template for Todo task and I would like to use “Templater : Create new note from template” to create a note where a todo inside the note have ne name of the note.
However the variables “tp.config.target_file.basename” and “tp.file.title” does not seem to be set when the note is created. I tried to use “await” but it doesn’t work either.

If I create first a note and after apply the template it works but It is less efficient.
Thanks for your help

How do you set the name of the new note? If that’s using a variable, then reuse that variable when inserting the todo text.

I use the command “Templater: Create new note from template” then I select the template and a box “Note title” appear. Then I write the name of the note and a note is created with this name but the “tp.config.target_file.basename” and “tp.file.title" are replaced by “Untitled 1”

Can you share your template ? Normally, you don’t have a text box for the name of the note. So, This means that you use a code that asks you for the name at some point in your template. You need to save it in a variable and put this variable in the place of tp.file.title.

Thanks both for your help :slight_smile:

Here is my template but I don’t really have something asking for the name

Project :

SubProject :

Todo

  • <% tp.config.target_file.basename %>
  • <% await tp.file.title %>

Done

Remark :

<% await tp.file.move(“/02 TASKS/” + tp.file.title) %>

What I do is :

  • Open command palette
  • search for “Templater: Create new note from template”
  • Then I have a box asking which template I want :
  • And when I select “Task” I get :
    image

I didn’t start my vault from scratch the maybe I missed something

It’s very strange. I don’t see where the text box comes from.
Are there no properties in this note? When you look in source view there’s nothing above Project?

Here is what I have in source mode :

---
creation date: <% tp.file.creation_date() %>
aliases:
Due Date: 
---

### Project : 
### SubProject : 

### Todo 
- [ ] <% tp.config.target_file.basename %>
- [ ] <% await tp.file.title %>

### Done 

### Remark : 


<% await tp.file.move("/02 TASKS/" + tp.file.title) %>

Ha maybe it is the “tp.file.title” which as for the title of the note ?

Edite: The box still appear when I delete the last line