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.

Has anyone found a resolution to this issue yet? I’m having the same error. <% tp.date.now(“YYYY.MM.DD”) %> does not render the date, it simply stays as <% tp.date.now(“YYYY.MM.DD”) %>.

I’m having similar issues. I’m using the core daily notes plugin, along with everything outlined in this daily notes template My Obsidian Daily Note Template | Dann Berg: blog, newsletter, shop, and more

Including the templater plugin and latest dataview plugin.

some parts render but some of templater and dataview don’t seem to translate


i’ve tried uninstalling/reinstalling/enabling/closing and reopening obsidian. i’ve tried disabling the original template core plugin. Nothing seems to work.

Is that an exact quote of your template? In case it is, it’s using smart quotes, and not straight quotes.

There is a difference between “YYYY.MM.DD”, and "YYYY.MM.DD".

In any case, does the console In Developers Tool tell you anything when you insert the template?

1 Like

It could look like you’ve got an issue with the order of which plugin runs first and last. Could you show us the entire template?

My template is literally a copy & paste of the template listed here

Oddly, I’m finding other templates, of entire vaults I’m testing like any of the templates listed here also don’t quite translate (with requested plugins enabled and updated) In reading view, I still see code like:

<%tp.date.now(“YYYY-MM-DD”)%>

<%tp.file.cursor(5)%>

<% moment(tp.file.title,‘YYYY-MM-DD’).format(“dddd, MMMM DD, YYYY”) %>

My understanding is the vaults are completely separate entities, yet I’m having these issues across vaults? Not sure what’s broken or missing for me.

solved, for some odd reason I need to add a + sign after %

2 Likes

Me too! That’s so odd. Would prefer not to have to do that in case it ever breaks

My solution was the following:
Disable core Template and Daily Notes plugins.
Disable Periodic Notes Plugin.
Close Obsidian.
Enable Periodic Notes Plugin.
Close Obsidian.
Open Obsidian.
After this everything was fine again.

I have resolve this issue by adding a + after <%
before change.

<% tp.file.title %>

<< <% tp.date.now(“YYYY-MM-DD”, -1, tp.file.title, “YYYY-MM-DD”) %> | <% tp.date.now(“YYYY-MM-DD”, 1, tp.file.title, “YYYY-MM-DD”) %>>>
<% tp.web.daily_quote() %>

after adding +

<%+ tp.file.title %>

<< [[<%+ tp.date.now(“YYYY-MM-DD”, -1, tp.file.title, “YYYY-MM-DD”) %>]] | [[<%+ tp.date.now(“YYYY-MM-DD”, 1, tp.file.title, “YYYY-MM-DD”) %>]]>>
<%+ tp.web.daily_quote() %>

thanks to Lon

1 Like