Replies: 1 comment 1 reply
-
This is a known behavior. We tend to work around it by referencing a variable in the template instead of <%*
const hasTitle = !tp.file.title.startsWith("Untitled");
let title;
if (!hasTitle) {
title = await tp.system.prompt("Title");
await tp.file.rename(title);
} else {
title = tp.file.title;
}
_%>
# <% title %>
// Using title instead of tp.file.title, since tp.file.title is outdated |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello-
This is a v odd scenario. I'm using tp.file.rename to change all new notes in a select folder to be named via date, but later in the note both in YAML & in the body of the note, I am unable to create an updateable version of the tp.file.title even if I ask it to await tp.file.rename.
I understand it's just a YAML problem for the title & backlinks to not update in the frontmatter, but it doesn't seem to work in the body of the note either, no matter how I phrase the template, tp.file.title always brings up 'Untitled' & if I change the title of the note to something completely different, it does not update. It remains Untitled.
Is this just a bug? Am I using tp.file.title for something it isn't meant to do? (update the title in real time)
I've seen versions of this problem in a few different Obsidian/Reddit threads, but all of the solutions just break the template.
Beta Was this translation helpful? Give feedback.
All reactions