metadatamenu icon indicating copy to clipboard operation
metadatamenu copied to clipboard

[FR] Automatically set FileClass

Open koenbunders opened this issue 1 year ago • 3 comments

Use case:

  1. Create a new file
  2. In YAML frontmatter (new Properties UI, version 1.4 of Obsidian) add a property / field, for example 'project:'
  3. As a value for this property, type a link to an existing file
  4. Expected behavior: the selected file automatically gets the FileClass 'Project'

(Inspired by Tana where certain nodes / field are automatically associated to a supertag)

koenbunders avatar Aug 01 '23 08:08 koenbunders

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!

Friedolito avatar Nov 22 '23 06:11 Friedolito

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

mdelobelle avatar Dec 02 '23 05:12 mdelobelle

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!

Friedolito avatar Feb 13 '24 22:02 Friedolito