What I’m trying to do
I’ve made a button that creates a new note with a specific template after clicking it and it works great! The only thing is, I would like to be able to enter a name for the note after clicking it (example at 1:41 here and 1:11 here).
Things I have tried
I tried following along with this tutorial : Obsidian - Buttons with Templater - YouTube
During the template creation stage, he shows this code on this screen (he goes over it at 8:22):
<%*
const hasTitle = !tp.file.startsWith(“test1”);
let title;
if (!hasTitle) {
title = await tp.system.prompt(“Title”);
await tp.file.rename(title);
} else {
title = tp.file.title;
}
%>
This code does not seem to work for me. I get an error that “tp.file.startsWith is not a function” in the console. I looked through the documentation for Templater and didn’t see this in there. Is he possibly using some sort of custom script? Is there any other way I can do this?
Thank you so much for your help!
l