Getting dynamic commands to work in the front matter YAML, it seems is either impossible or only inconsistently possible. For example, I have a frontmatter field mdate:
that represents the last-modified date of the document. One might expect the following to work:
<%+ tp.file.last_modified_date() %>
but it doesn’t. I couldn’t seem to get Dataview inline queries to work in the frontmatter section either. A now-closed thread on this forum and others on r/ObsidianMD have been dead-ends if your goal is to dynamically update the frontmatter section of the document.
But, if you are comfortable working in the command-line shell, I wrote up a solution: Using fswatch
to dynamically update Obsidian documents. I have the script that I posted in that article running against my vault and it works beautifully. You’re free to adapt and use it as you like.
I’ve tested it thoroughly on macOS; and I’ve tested bits and pieces of it on a Debian VM. As for Windows, I don’t know since I have no Windows machine to test it.
If someone has a solution that’s internal to Obsidian, I’m all ears, though!