All of a sudden my Templater Templates are not working today. They worked yesterday, I use Daily Note every day but when I ran it today the code between <% and %> remains unprocessed and inserted as code. This is consistent across two separate apple laptops.
I’ve tried restarting Obsidian, removing Templater and installing it again but nothing helped.
What could be the reason?
You could check if Templater is still enabled (not just installed), and if the Templater setting “Trigger Templater on new file creation” is toggled on - it’s disabled by default after a fresh install; a note created with a template by the “Daily notes” plugin would remain unprocessed by Templater in this default case.
Here is the code from the template. The challenge is that it worked multiple times, and I have not modified anything since the last run. It’s supposed to prompt for an ‘index’ and then rename the current note to “Newsletter index.1” where index is the response taken on the prompt
// create new filename
let newsletter_index = await tp.system.prompt(“Current index:”);
note_name = “Newsletter “+newsletter_index+”.1”;
await tp.file.rename(note_name) %>
Except of the wrong quotation marks (“ and ” vs. "), the template is fine. Works on my installation as expected.
With the quotation marks as posted by you, there is a silent failure: in the Developer Console (Ctrl+Shift+I on my installation) appears: Templater Error: Template parsing error, aborting. Template syntax error: Invalid or unexpected token
Most likely he’s got the right quotes, but just the wrong formatting.
In a forum post it’s best to include four backticks on the line before and after your markdown (or codr blocks or queries), add it then renders beautifully and quotes are not converted by the forum software.
If you have user templates, there might be a code error in one of those. This will prevent Templater from starting up in the first place, and will make it unable to execute any templates, even ones that have never been changed.
If you check your console you might see some helpful error messages (Ctrl + Cmd + i or something like that for Mac).