metadatamenu
metadatamenu copied to clipboard
insertMissingFields seems to clear content when used with Templater + Periodic Note + Trigger
I have my vault setup with Templater, MetadataMenu + PeriodicNotes
Setup templater to be called when a note gets created in my daily note folder, using my daily note template. Setup MetadataMenu with classes.
In the daily note template I put in the fileClass property with my daily note class.
At this point, all is well. Templates gets used when I create a daily note.
Now I want to insert the missing fields into the note so I tried to call the API from within the template:
<%*
await app.plugins.plugins["metadata-menu"].api.insertMissingFields(tp.file.path(true), 1)
-%>
When I create a daily note I see that the template content gets inserted but it all vanishes.
Using fileFields api call works and does not clear the note content as to make sure I call the api correctly 😉
Using any other templater commands works, it's only insertMissingFields that clears the note.
Not sure what I am doing wrong...
can you test with the new beta version ? https://github.com/mdelobelle/metadatamenu/releases/tag/0.6.0-beta-8 I think that you have experienced conflicting files updates: 1 from templater and 1 from metadata menu. The new version has a different indexing/modifying files lifecycle, maybe this will fix you use case
@mdelobelle still happening for me and I am using Metadata Menu 0.8.5 and Templater 2.2.3. I am using "filesPaths" to assign fileClass.
Thanks for any help!
I ran in to this issue as well.
Poked around the Obsidian Discord and found this command:
<%* tp.hooks.on_all_templates_executed(() => {MetadataMenu.api.insertMissingFields(tp.file.path(true), 1); }); -%>
Which at least keeps the results of the insertMissingFields, but they are inserted inline, not in the frontmatter/properties, which is where I personally want them.
Obsidian 1.6, Templater 2.3.3, Metadata Menu 0.8.7