How to get note name from property "Title"?

What I’m trying to do

Hello,
I’m using the Templater plugin, and I’d like to make a template that allows me, when I use it with the “create new note from template” command, to enter the title of the new note in a pop-up that not only fills in a “Title” property but also replaces with this entered title the default “Untitled” title of this new note. I’m pretty bad at programming…

Things I have tried

I’ve figured out how to enter the title in the property with <% tp.system.prompt(“Note title”) %> but I don’t know how to get it back for the note title… Thanks for your help.

Not an expert in Templater, but I had a similar problem, then I read somewhere that you can not name it, but you can rename it. This I have in my template …

<% await tp.file.rename("Week "+ moment().format("WW")) %>

… and will rename it after it is done.

Cheers, Marko :nerd_face:

This fairly untested but something like this should work :blush:
(If I understood correctly what you were trying to do :see_no_evil_monkey: )

<%*
const title = await tp.system.prompt("Note title");
await tp.file.rename(title);
-%>
<% "---" %>
title: <% title %>
<% "---" %>

Inspiration:

1 Like

Hello.

I have given up using Templater, but used to use the following to name notes and move them to a specified folder. Along the lines of what you need?

<%*
 let title = tp.file.title
  if (title.startsWith("Untitled")) {
    title = await tp.system.prompt("Title");
  } 
  await tp.file.move("/Notes/" + title)
  tR += "---"
%>
title: <% title %>
date: <% tp.date.now("YYYY-MM-DD") %>
created: <% tp.file.creation_date("YYYY-MM-DDTHH:mm:ss") %>
<%"---"%>

# [[<% title %>]]