I am trying to set up a button in Obsidian to create a new page within a specific folder using the Templater and Buttons plugins. However, when I click the button, nothing happens, and I receive an error saying, “could not find the specified template.” Here’s the code for my button:
name Create new page
type template
action {"template":"ObsTech/Temps/new.md","folder":"CV/Skills/Probability Theory","filename":"<% tp.file.prompt('Enter the name for the new page') %>"}
I’ve confirmed that the template exists and the path is correct. Could someone please guide me on what might be going wrong or how to correctly set up this button to prompt for a new page name and create it in the specified folder?
What lead you to put the action in a JSON format? Does that work for your other buttons?
Normally to create a new note and insert the template the format is:
name Create new page
type note(Note name) template
action new
You can use Templater to move the file to the correct folder and to prompt to rename it after you use the button to create it. So your “new” template could include:
<%
await tp.file.move("/CV/Probability Theory/" + (await tp.system.prompt("Enter the name for the new page")))
%>
name Create new page
type note(Note name) template
action ProbTemp
and the template:
<%*
const newPageName = await tp.system.prompt(“Enter the name for the new page”); await tp.file.move(“/CV/Skills/Probability Theory/” + newPageName);
%>