Skip to content
Discussion options

You must be logged in to vote

tp.file.title doesn't update once Template execution starts. You'll need to reorganize your template to get the new file name first, then reference that instead of tp.file.title. For example:

<%*
const folder = "01_test";
let name = tp.file.title;
if (!tp.file.folder(true).startsWith(folder)) {
    name = await tp.system.prompt("Test name");
    if (!name) return;
    await tp.file.rename(name); 
    await tp.file.move(`${folder}/${name}`);
}
%>
# Project name: <% name %>

📅 <% tp.date.now("dddd, D MMMM YYYY") %>

- [ ] 
- [x]
----

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@foloryx-inc
Comment options

Answer selected by foloryx-inc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants