Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Folder Notes take priority when creating file #1370

Closed
revennui opened this issue May 6, 2024 · 7 comments
Closed

Folder Notes take priority when creating file #1370

revennui opened this issue May 6, 2024 · 7 comments
Labels
bug Something isn't working

Comments

@revennui
Copy link

revennui commented May 6, 2024

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 :)

@revennui revennui added the bug Something isn't working label May 6, 2024
@Zachatoo
Copy link
Collaborator

Zachatoo commented May 8, 2024

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?

2024-05-07_21-29-39.mp4

@Zachatoo Zachatoo added the awaiting response More information has been requested, waiting to hear from the submitter label May 8, 2024
@FeralFlora
Copy link

FeralFlora commented May 8, 2024

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

Obsidian_8vrXbouDlL

Folder template does not override chosen concept template

Obsidian_8RYAfnL2Xj

@Zachatoo
Copy link
Collaborator

Zachatoo commented May 9, 2024

@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.

@Zachatoo
Copy link
Collaborator

Zachatoo commented May 9, 2024

@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...
-%>

@Zachatoo
Copy link
Collaborator

Zachatoo commented May 9, 2024

Attempted a fix in 2.3.1, can I get someone to verify if the fix worked or not?

@FeralFlora
Copy link

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 💪

@revennui
Copy link
Author

revennui commented May 9, 2024

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!

@Zachatoo Zachatoo removed the awaiting response More information has been requested, waiting to hear from the submitter label May 9, 2024
@Zachatoo Zachatoo closed this as completed May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants