I’m creating my own Zettlekasten-style template (I realise there is a default plugin for this but I want a little more customisation of my templates) using the Templater community plugin.
On applying the template to a file I want to:
Automatically set the title to be that of the current timestamp
Move the file to a ‘Notes’ folder (with the new title)
What I’ve tried
I’ve tried using this in my templates but am currently receiving a “template parsing error”.
<%*
// Set the current timestamp as the filename
await tp.file.rename(tp.file.creation_date("YYYYMMDDHHmmss"));
await title = tp.file.title;
// Move to the Notes folder
tp.file.move("Notes/" + title)
%>
Can anyone help to suggest how I may fix the issue and achieve the above two steps?
Ah, the problem was actually to do with paths as I made a small typo. I can confirm that your suggestion works perfectly, and cuts out an extra rename operation.
Yes, you do want a “/” between your folder name and your file name. Were your rename and move lines working independently? (i.e. if you tried just one of them)
I’m a little surprised that setting a variable in the middle of your call to rename (now move) is working. Do you use mytitle elsewhere? If not, can you get rid of just mytitle = from the line I quoted? Does that change anything?