FrontMatter or MetaData / Inline for Keys

So I need some helps from people who are already using Obsidian and plugins for a longer time.

What is the best approach to store custom keys: FrontMatter or MetaData / Inline?

Just found out that duplicating the Keys in FrontMatter and MetaData / Inline not really works when you want to use the Dataview plugin.

Any insights?

It works… The problem is: you have two values (an array). For that you can’t use WHERE field = "value", because “=” means equals. You need to use contains().

what would the syntax be?

LIST
WHERE  Vault.contains("Privat")

returns:

Dataview: Every row during operation 'where' failed with an error; first 3:

                - Cannot call type 'array' as a function
- Cannot call type 'null' as a function
- Cannot call type 'null' as a function

see answer in other post: Dataview with keys from frontmatter not working - #6 by mnvwvnm

ok, I stand corrected that this doesn’t work with dataview.

But how do other people use the FrontMatter and MetaData / Inline Keys?

Both, only FrontMatter, only MetaData / Inline, depends?

I think it’s a matter of personal preference.

For myself, I usually prefer using inline DataView fields (e.g. Field:: Value) over YAML because I consider the fields to be part of the content of the page, and I want them to be visible when I look at the page in reader mode.

2 Likes

I agree with @Craig - there’s not a “best way”.

There’re cases where the best option is the yaml field, others the inline field.

An example: if you use in frontmatter aliases: other title Obsidian automatically recognized this field as your note alias. As metadata, this becomes a value in the implicit field file.aliases (a default array). If you add this field as inline field - aliases:: other title- this is just a normal custom field with the key-name aliases, not a really alias to your note!

Another one: if you use an inline file as key:: [[File A]], because the link is in your note content, [[File A]] becomes also an outgoing link, recognized in “outgoing links” pane and in graphs. If instead you use an yaml frontmatter field - key: "[[File A]]" - this link doesn’t account as outlink neither shows in graphs (also, it doesn’t auto-update the link if you change the file name).

These are some examples… We can’t list all the nuances. You need to explore and understand the differences.

1 Like

thanks for the starting information, so much to learn :grinning:
I think I will for sure try to separate the more “immutable” data into yaml and the more dynamic (and in your face) data inline.
But I agree you need to learn and adopt it for yourself.