This requires a listener to the “File opened” event. There might be a good implementation for a new MetaEdit feature that does this, but I’d have to think it through. For now, you could make a simple plugin for Obsidian that listens to that event and then calls the MetaEdit function if the attribute is present. :slight_smile:

Unfortunately, there’s not much in the way of quick fixes. Supporting proper YAML has been on my to-do list for the longest time, so it’s probably the very next thing I’ll do. Only arrays are supported at the moment (e.g., [1, 2, 3]).

Tracker allows you to specify a value after the tag, i.e., #tag:value. So depending on which option is chosen, MetaEdit will either update the value, or the last part of the tag #here or #change/here, where here will be changed.

Hope this helps!

1 Like

im not a developer, maybe i will try to learn how develop a plugin

thx for your reply, and plz consider to add this feature

1 Like

I’m trying to create a button that updates a specified metadata field (either YAML or dvfield) that is in the same file as the button. Very similar to the example documented on the plugin wiki - Complete Task in Dataview Table - just not in a dataview table. Seems it should be simple enough, however with my limited programming skills I cant’ work it out. Anyone know how to achieve this?

p.s. - thank you @Christian for making such amazing plugins - metaedit and quickadd have transformed how I use Obsidian.

Hi, can you explain how you can delete property easily with the plugin ? I can’t seem to find a documentation for this.

Hey @Jeremy, glad to hear you like my plugins :slight_smile:

As for your question: I don’t have much experience with Buttons, but I tried my hand at making it work. From what I could tell, you’d want to either make it insert a Templater template into the file, where the template contains an API call to MetaEdit’s update.
You could also just make the button call a QuickAdd capture/macro, which could also call the update function.

When you open the MetaEdit menu, you’ll see on the right a :x:. Clicking that should allow you to delete the property.

1 Like

I asked because I thought there was an undocumented API function for deleting. Thank you again.

Ah, not currently. It’s planned, though. I am working on an update which would include it.

2 Likes

Thanks for getting back to me Christian. @imed actually helped me out by using the first method you suggested. For anyone that might be interested in the future here’s the template:

<%* 
const {update} = app.plugins.plugins["metaedit"].api 
const file = tp.file.find_tfile(tp.file.title) 
await update("<insert field>", "<insert value>", file) 
_%>
2 Likes

I’m currently trying to set up some habit tracking in obsidian. I want a button that will append a value to a list in the frontmatter. Any thoughts on this?

I’m working on a version that supports adding elements to list items in the frontmatter.
Until then, it’s currently not supported. QuickAdd has a feature that allows you to do this, though. You use the Insert After feature in a capture.

1 Like

I am getting a console error that was able to trace back to this plugin. Just wanted to report it here before filing on GitHub.

Thank you!

Can anyone suggest a way to add the current title of a note as an alias, so that when I change the title, I still have a way of referring to (and autocompleting on) the title before the change? I was hoping that {{title}} would work, but I can’t see how.

Are you doing some kind of scripting or templating to make this work? Has the note been created? Is this regarding many notes, or just one or two? Or, do you want some automatic workflow for it?

Legitimate questions! Definitely this is far already existing files. I’m not looking to automate this. It would mostly be one or two at a time. But even so, it would be great to just be able to have a hot key to run this. At the same time, as long as I’m getting error if there is already an existing file, it might be simpler just to use Templater with a hot key that inserts {{title}}.

This can be done in a few lines of code:

const currentFile = app.workspace.getActiveFile()
if (!currentFile) {
  return new Notice("No active file");
}
await app.plugins.plugins.metaedit.api.createYamlProperty("alias", currentFile.basename, currentFile)

You can use Templater or QuickAdd to activate the code - depending on your preferences :slight_smile:

Thanks, but I’m clearly in over my head, since I don’ t understand what “activate the code” refers to. :person_shrugging: