What I’m trying to do
I’m tying to create a note from a template that has a saved name and title of the folder name plus appended text.
An example is to ‘Create note from template’ in a folder with structure 2-Areas/Code/Python
I want to name the note Python Tasks and maintain the metadata in the template:
---
title: <% tp.file.folder() %>
date: <% moment(tp.file.creation_date()).format("YYYY-MM-DD HH:mm:ss") %>
creation_date: <% tp.file.creation_date() %>
modification_date: <% tp.file.last_modified_date("dddd, Do MMMM YYYY, HH:mm:ss") %>
lastmod
Project: <% tp.file.folder() %>
categories:
tags: taskbone todoist
aliases:
---
Things I have tried
I’ve tried everything I can think of… but not matter where I perform the rename, I loose all of the existing content of the template.
I’ve tried using a myriad of other examples people have kindly published but no luck, so hoping this is the right place to ask for guidance.
One example of the template:
---
title: <% tp.file.folder()+" Tasks" %>
date: <% moment(tp.file.creation_date()).format("YYYY-MM-DD HH:mm:ss") %>
creation_date: <% tp.file.creation_date() %>
modification_date: <% tp.file.last_modified_date("dddd, Do MMMM YYYY, HH:mm:ss") %>
Project: <% tp.file.folder() %>
categories:
tags: taskbone todoist
aliases:
---
<% await tp.file.rename(tp.file.folder()+" Tasks")%>
# <% tp.file.title %>`
- Without the tp.file.rename : I get the correct content but with an “Untitled” name
- With rename I have the correct file name but no content (including metadata)
Any guidance would be grateful appreciated.
Please note, I have also posted in the Templater Github discussions (Creating a note from a template that has a saved name and title of the folder name plus appended text · SilentVoid13/Templater · Discussion #1171 · GitHub) so hope this crossposting is acceptable.