Auto-update File Title Based on YAML Metadata Value?

First, search the help docs and this forum. Maybe your question has been answered! The debugging steps can help, too. Still stuck? Delete this line and proceed.

What I’m trying to do

Objective: I want to automatically update the title of an existing note/file based on the value populated in a specific YAML field (winename).

Use Case: I have notes about wines with YAML metadata. When I populate the winename field in the YAML, I’d like the note’s title (i.e., the filename) to be automatically updated to reflect this winename value.

For instance, if my YAML looks like:

yamlCopy code

winename: Chardonnay Vintage 2021

I want the note’s title to change to “Chardonnay Vintage 2021”.

Current Setup: I’ve tried using Dataview queries to filter notes based on the winename value, but haven’t found a way to automate the renaming process.

Question: Is there a way, possibly using plugins, scripts, or a combination of features in Obsidian, to achieve this behavior? Any advice, plugins, or workflow suggestions would be much appreciated.

Things I have tried

Asked the obsidian forum!

I don’t know any plugin doing that, which doesn’t mean there isn’t any, it’s just me not knowing. However, I do know that if you have them identical all the time, then why not just use instead of winename in you queries?

Potentially with a property/field in those notes to denote that this file is indeed a wine file.

as a interim solution - i just added to the top of my note which has helped

= this.file.frontmatter.winename