Templater
Templater copied to clipboard
Folder Notes take priority when creating file
Plugin information (please complete the following information):
- OS: Windows 10
- Templater version: 2.2.3
- Obsidian version: 1.5.12
Describe the bug
Having set folder notes, creating a new note using the command "Create new note from template" and choosing a different template than the one specified for this folder, overwrites the content of the template you picked with the folder note's template. This seems to be an error, as specific user action should trump general action.
Expected behavior Manually creating a note in a location should always use the template explicitly specified.
Many thanks :)
I'm not able to reproduce this issue. Here is a video of me trying to reproduce. Are there any other details you can provide?
https://github.com/SilentVoid13/Templater/assets/6936914/d8d29e56-236c-492a-bf20-3c5f2ab0ec95
I can reproduce it, with the finding that it only occurs when I create notes using some particular templates.
When I tested it, I was creating notes in my person folder, to see if the person template would get applied.
When I right click the folder, choose "Create new note from template", and then choose the concept template, only the concept template is applied. But when I choose the base template, only the person template is applied. This happened consistently.
I think it has to do with the fact that the base template only adds frontmatter using processFrontmatter
, in my mergeFrontmatter
userscript. The concept template also adds frontmatter using this script, but it has actual content as well. If I add content to the base template, it does not get overridden by the folder template anymore.
These templates are fairly large and have user script dependencies, but I can share it all if you want, @Zachatoo.
Demos
Folder template overrides chosen base template
Folder template does not override chosen concept template
@FeralFlora I believe I've followed your scenario and I can't reproduce. I would appreciate if you would send me what you're working with so I can at least verify if I can reproduce on my end so I can verify when I fix it. Send it to me wherever is most convenient to you, I've got GitHub, Discord, and email all open.
@FeralFlora And of course, now I can reproduce using the template from this issue #1372 . The folder template is triggered during the first prompt, before the file has any content.
<%*
let qcFileName = tp.file.title;
if (qcFileName.startsWith("Untitled")) {
qcFileName = await tp.system.prompt("Note Title");
}
// more logic...
-%>
Attempted a fix in 2.3.1, can I get someone to verify if the fix worked or not?
Attempted a fix in 2.3.1, can I get someone to verify if the fix worked or not?
After updating Templater, and restarting Obsidian, everything now works as expected for me, and I cannot reproduce the bug anymore. So it certainly seems like your fix worked 💪
Attempted a fix in 2.3.1, can I get someone to verify if the fix worked or not?
Fixed for me too, thanks for the fast response!