metadatamenu
metadatamenu copied to clipboard
[FR] Automatically set FileClass
Use case:
- Create a new file
- In YAML frontmatter (new Properties UI, version 1.4 of Obsidian) add a property / field, for example 'project:'
- As a value for this property, type a link to an existing file
- Expected behavior: the selected file automatically gets the FileClass 'Project'
(Inspired by Tana where certain nodes / field are automatically associated to a supertag)
I would love to see this feature being implemented. (But I have no idea how feasable this is) Tag VS property field for defining a type of a note remains a disputed area, but especially with the new properties manager and having backlinks in the metadata, I guess there are a substential number of people using now properties for that.
In my perspective, having added the relevant metadata fields when setting a type by a property would be a major QOL update when using obsidian,
Thank you so much for the work you are doing and have done so far!
you could try this setup based on a gloabl fileclass containing a select field filled with the list of fileclasses
https://www.youtube.com/watch?v=yRt_9fDRd_A&t=390s
Hey,
I got this working with Query based FileClass settings. With help out of the community I created this query for dataviewJS:
dv.pages().where(p => dv.func.contains(p.type, dv.fileLink("name of internal link")))
Just create queries for fileclasses and it works 👍 So thank you for implementing this mdelobelle!
But I still hope for a native implementation, since I think this is fundamental useful ;)
Setting up queries is cumbersome and it would be nice to just have an option to quickly connect the fileclass with a link. I too wonder if it gets heavy on the performance when checking a lot of queries in the background (?).
I don't have any programming knowledge, but was thinking how it could work:
Could the plug-in create a list of paired field values and fileclasses? So setting up a "special" field (e.g. "type") that has the ability to set fileclasses. In a fileclass (e.g. fileclass_countries) have an option to set a paired internal link (e.g. "[[countries]]"). It then adds this information to the list:
- if type:: [[countries]] -> fileclass: fileclass_countries
Now when one opens a file, if it has the "special" field ("type") it will check the list and if there is a match with an internal link, it applies the right file class.
Thoughts on this?
I would love this feature, but I'm already more than happy with metadatamenu as is it ;) So just an idea.
As always thanks for putting so much work in the plug-in!