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!

1 Like

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 file.name 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

@freddiecaspian, I know this has been sitting for a while but I had a need for something similar so I made this this afternoon. It’s a macro you can use with QuickAdd and MetaEdit. Both are written by the same dev, btw. It’s the only way I know of at the moment that can provide this kind of experience. If you are looking for a fully automated way using dataview that is also achievable with just DV and ME installed. I went for the UI approach b/c that’s how I’d prefer it atm.

So here’s a demo video and vault and also the macro .js to get you or someone else going. Use in good health!

1 Like