After watching this video I liked the idea of using notes as tags. However, I thought why not use the links in frontmatter (or maybe also inline sometimes), so that I can also query these “note tags” with dataview?
In the instructions of Dataview metadata data types is written
If you reference a link in frontmatter, you need to quote it, as so: key: "[[Link]]" . This is default Obsidian-supported behavior. Unquoted links lead to a invalid YAML frontmatter that cannot be parsed anymore.
If I put the link [[test]] in a frontmatter (list) value field, the Dataview query works perfectly fine?
Am I missing something here or maybe something has changed?
I would love to use it this way, however, I wanted to clarify upfront if this works, not that I must realize having a big problem later on.
I would also take the opportunity and ask if it’s possible to query for “and more random text” in dataview? Example: if I query WHERE contains(nameofkey [[test]]) it works completely fine. However, if I made a link to a section of a note with e.g. [[test^a72808]], dataview can’t find it anymore with this query.
Here I would like to have a query which searches for a property value which has [[test+some random text]] in it, so that not only the results for the exact value [[test]] are displayed.
Although I use Obsidian about a year now (only for daily journal entries), I’m quite new to Dataview etc. Sorry for my bad English, it isn’t my main language.
But if you don’t quote the link in the frontmatter, there’s no guarantee there won’t be a mix up somewhere down the line …
I mean, this:
---
listThree: [[testThree]]
---
Is much more likely to be interpreted by Dataview either as a list type of key containing the text value [testThree] (which Obsidian might not be able to read correctly because of the missing quotes around the link) or maybe a list of list containing the text value testThree ( ) or simply a text type of key containing the value [[testThree]] … which will probably lead to issues if you add more than one link to the key.
(I could be wrong though … I use Properties, rarely interact with YAML in Source mode and let Obsidian manage the validation of YAML for me )
So, in other words, my advice would be to just stick with quotes around internal links as they are required to avoid mixing up internal links with list as arrays …
I enter the links in the Value field in Frontmatter (side panel or on the top part of my note since because of my settings it is displayed there). I almost never use the source mode.
Now I’ve realized that when I enter [[test]] in the frontmatter value and have a look at this in source mode, then it displays it as "[[test]]”. It looks like this is done automatically
It even displays a suggestion coming from my last (linked) entries when I type in something in this value field
So that would mean that I can use it like this without having to worry that something “breaks”, right?
When I tested it (after reading the instructions) with entering “[[test]]”, it transformed it to ““[[test]]“” when looked at it in source mode.
Where I’m still unsure: Is this different when a property value is typed in inline in a note? Do I have to write the “” there surround the link?
E.g. testkey:: "[[test]]“ or [[test]] ?
Even when in source mode I can’t see what Obsidian / Dataview does there…
Do any of you know a solution when you want to include “some random additional text” in a dataview query (like written in my first post)? I mean so that dataview does also include [[test^a72808]] in the displayed results and not only results that are exactly [[test]]?
A query like Where contains(testkey, [[test**“”**]]) or something? This example doesn’t work unfortunately.
---
Tags: f91106
linkList:
- "[[first]]"
- "[[second|2nd]]"
---
questionUrl:: http://forum.obsidian.md/t//91106
```dataview
TABLE WITHOUT ID link, meta(link)
WHERE file = this.file
FLATTEN linkList as link
```
And it outputs this:
In other words, if you got a property with a link in it you can use meta(...) on that link, and then access the various parts of the link as you feel like. So if you want explicitly to check the display value you could use meta(link).display, and similar.
Another useful trick can be to use string(link) which transforms the link property into a string making checks using contains and similar easier. Here is a query trying to showcase this:
```dataview
TABLE WITHOUT ID link, string(link), contains(string(link), "2nd"), contains(link, "2nd")
WHERE file = this.file
FLATTEN linkList as link
```
Notice how the the second row third column correctly identifies that the actual output of the link contains “2nd”, which it doesn’t do with just a pure contains() as in the fourth column.