Templater
Templater copied to clipboard
NaN as output if I use the + sign
Hi,
when I use the plus sign
creation_date: <%+ tp.file.creation_date("dddd, DD. MMMM YYYY, HH:mm:ss") %> Uhr
modification_date: <%+ tp.file.last_modified_date("dddd, DD. MMMM YYYY, HH:mm:ss") %> Uhr
as mentioned here https://silentvoid13.github.io/Templater/commands/dynamic-command.html
I get NaN in the file made with this template.
# <%+ tp.file.title %>
does also give NaN.
Windows 10, latest plugins, latest obsidian.
Couldn't replicate bug. Switching to Preview mode from Edit mode displays the correct result from the dynamic command.
Windows 11 Home 22H2 Obsidian v1.1.9 (No other plugin installed other than Templater) Templater v1.16.0
Ok I think I get your problem though. When ever you insert template or create a new note with template, the dynamic code is executed instead of simply copying the dynamic code over as text.
Possibly the same issue as #910
I highly recommend using dataview for this purpose instead, it works way more reliably for dynamic content, which is why this issue came up to deprecate dynamic commands at some point #913
@Zachatoo Ah I see! That's why the function was nominated for deprecation!
Ok I think I get your problem though. When ever you insert template or create a new note with template, the dynamic code is executed instead of simply copying the dynamic code over as text.
This is the actual issue, that I have, too.
I highly recommend using dataview for this purpose instead, it works way more reliably for dynamic content, which is why this issue came up to deprecate dynamic commands at some point #913
@Zachatoo How would you use dataview for this purpose though? Do you mean insert a dataview query in the template file?
Yes, exactly. Other plugins tend to work great with Templater in this regard.
<% tp.file.title %>
More of whatever...
```dataview
dataview stuff
```
Or inline dataview `= this.whatever`