What I’m trying to do
Have a template for contacts use the file name (which is the contacts name) paste into the note after I set the file name.
Things I have tried
I cannot seem to find the right wording to find any help online. But here is the code I am using in my template:
## 📛 Hello, my name is...
**Name:** <% await tp.file.title %>
**Pronouns:**
**Company:**
**Phone:**
**Address:**
**Website:**
**Email:**
**Affiliation(s):**
-
**Title:**
**Location:**
**Website:**
---
## 📝 Contact Notes:
-
What is happening:
So the file is created correctly, but where the title should go, (Name:) is Untitled because that is what the new file is created as.
Name: Untitled
Can someone please tell me how I can accomplish what I want? Please Thank you in advance.
holroy
March 13, 2025, 7:34pm
2
At the very start of your template you need to detect whether the file is named “Untitled” or similar, and change it before you move on to the rest of the template. An example on how to do this is given in the thread below:
You can accomplish this with the Templater plugin.
I have turned on the option to allow Templater to trigger on new file creation. My new notes use the following template:
<%*
let title = tp.file.title
if (title.startsWith("Untitled")) {
title = await tp.system.prompt("Title");
await tp.file.rename(`${title}`);
}
tR += "---"
%>
tags: Note <%tp.file.creation_date("YYYY")%>
---
# <%* tR += `${title}` %>
<% tp.file.cursor() %>
___
## References:
-
---
creation date:: [[<%tp.…
system
Closed
June 11, 2025, 7:34pm
3
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.