Templater Syntax Plugin Not Working

Would anyone have any idea what I could be doing wrong here? Thank you in advance

Issue:

Templater syntax not working

Example:

<%tp.date.now()%> remains <%tp.date.now()%> instead of:

<%tp.date.now()%> to 2022-04-23

Settings/Other actions taken:

  • Installed and enabled templater plugin, made sure it is updated
  • Set templater folder to “Templates” folder and my settings as:


  • Turned off core plugin “templates”
  • customized hotkeys of templater

2 Likes

I’m having the same issue with my daily notes plugin. Not sure why

@fedderw To clarify, you are using “Daily Notes” core plugin (not the “Periodic Notes” community plugin), “Templater” community plugin, and have disabled “Templates” core plugin? Additionally, you’ve checked that your community plugins are up to date (“Settings” → “Community Plugins” → “Check for Updates” button, must be checked manually), closed and re-opened Obsidian after installing any updates to plugins, specified the correct Template file in the “Settings” → “Daily Notes” settings, and in the “Settings” → “Templater” settings you have “Trigger Templater on new file creation” turned on?

If you manually run the “Templater: Replace templates in the active file” command from your note that isn’t fully transforming, does any further transformation happen? Do you get any output in the developer console during the new note creation process?

To clarify, you are using “Daily Notes” core plugin (not the “Periodic Notes” community plugin)

No, I’ve been using periodic notes. Here is the error message from the console:

plugin:templater-obsidian:82 Templater Error: Template parsing error, aborting. 
 dv is not defined
log_error @ plugin:templater-obsidian:82

The template used starts like this:

---
creation date: <% tp.file.creation_date() %>

modification date: <% tp.file.last_modified_date("dddd Do MMMM YYYY HH:mm:ss") %>
---

<< [[<% tp.date.now("YYYY-MM-DD", -1) %>]] | [[<% tp.date.now("YYYY-MM-DD", 1) %>]] >>

If you manually run the “Templater: Replace templates in the active file” command from your note that isn’t fully transforming, does any further transformation happen? Do you get any output in the developer console during the new note creation process?

I actually get this error on any file where I try this command. Here is an example:

Templater Error: Template parsing error, aborting. 
 dv is not defined
log_error @ plugin:templater-obsidian:82
eval @ plugin:templater-obsidian:103
rejected @ plugin:templater-obsidian:57
Promise.then (async)
step @ plugin:templater-obsidian:62
eval @ plugin:templater-obsidian:63
__async @ plugin:templater-obsidian:47
errorWrapper @ plugin:templater-obsidian:98
eval @ plugin:templater-obsidian:3813
eval @ plugin:templater-obsidian:63
__async @ plugin:templater-obsidian:47
overwrite_file_commands @ plugin:templater-obsidian:3811
overwrite_active_file_commands @ plugin:templater-obsidian:3808
callback @ plugin:templater-obsidian:4010
jz @ app.js:1
t.executeCommand @ app.js:1
t.onTrigger @ app.js:1
t.handleKey @ app.js:1
t.handleKey @ app.js:1
e.handleKey @ app.js:1
t.onKeyEvent @ app.js:1

Do you have any scripts that are not for Templater in the folder Templater is checking for user scripts? Specifically, perhaps something for dataview that you import via dv.view somewhere? That makes Templater unhappy, as I and several others have discovered in the past few days/weeks.
Make sure the Templater user scripts folder just has things for Templater in it, perhaps by making a subfolder just for Templater within your current scripts folder and changing the setting on the Templater settings page to refer to that?

1 Like

Yes, this was the problem! I made a seperate templater and templaterJS folder and that seemed to sort things out. Thanks!

2 Likes

Hi! Can you explain a little bit more please? I am having the same problem. However I am not using user scripts. I just use templater with dv and tasks plugins. It runs OK if i run the template after file creation but gets an error when creating the daily note automatically. I have the “Trigger Templater on new file creation” option activated, so that’s not it.

1 Like

This solved my problem – I hadn’t deactivated the Template and Daily Notes core plugins. Thank you!

I have deactivated the Templates and Daily notes core plugins, however my Templater commands do not work on my daily notes using the Periodic Notes plugin, eg: <% tp.date.now(“YYYY-MM-DD”) %> remains verbatim, but if I generate a note from a template then the Templater command works and instead is the {{date:YYYY-MM-DD}} which does not update or triggers (I am unsure what’s the correct terminology here).

1 Like

Have you found the solution? Same problem here

Well, I was having a date error when oppening my Daily Note. It happened that I had this code in my template:

<< [[<% tp.date.now("YYYY-MM-DD-dddd", -1, "YYYY-MM-DD-dddd") %>]] | [[<% tp.date.now("YYYY-MM-DD-dddd", 1, "YYYY-MM-DD-dddd") %>]]>>

and not this (which worked fine):
<< [[<% tp.date.now("YYYY-MM-DD-dddd", -1, **tp.file.title,** "YYYY-MM-DD-dddd") %>]] | [[<% tp.date.now("YYYY-MM-DD-dddd", 1, **tp.file.title,** "YYYY-MM-DD-dddd") %>]]>>

I probably removed it while changing my template daily note.