Because in same cases it’s more accurate to work with links than with strings.
But before let’s put things in this way.
- Why use yaml format with syntax for “lists” and not for a single elements? In same cases you have “multiple” values for same field?
If only one value, it’s more advised to use this format:
---
aliases: Note1
references: Note 2
---
Why? Because the function contains() works in different ways if a list or a string.
For example, your first query is inverted and not work well. The function contains works with this logic: contains(object-or-list-or-string, value).
Your query ‘logic’ should be: “where” the “file.name” contains the value in “this.reference”:
```dataview
LIST
WHERE contains(file.name, this.references)
```
If the value “this.references” is one element (in the format “references: Note 2”) then query presents all files with “Note 2” in the name (if any with the name “This is my Note 2”, it’s listed too).
But if the value “this.references” is a “list” (with one or more values), then the query results are a mess.
- If you use links instead of “strings”, you reduce some issues, because you don’t need to find a relation between your “string” (or “strings”) and file names/links: you have links and this is enough. If links in your field, you just need to query your references (and if your notes have aliases it’s possible to replace the file name by file aliases):
---
aliases: Note1
references:
- "[[Note 2]]"
- "[[Note 3]]"
---
## inline query
`=this.references`
## list
```dataview
LIST WITHOUT ID references
WHERE file.link = this.file.link
```
## list (display links by aliases)
```dataview
LIST WITHOUT ID link(references, references.aliases)
WHERE file.link = this.file.link
```
- If instead of yaml frontmatter fields you use inline fields, then the links count as backlinks and you can use queries to display
file.inlinks and/or file.outlinks.
ref:: "[[Note 2]]", "[[Note 3]]"
## inline query
`=this.ref`
`=this.file.outlinks`
## list 1
```dataview
LIST
FROM outgoing([[#]])
```
## list 2
```dataview
LIST WITHOUT ID file.outlinks
WHERE file.link = this.file.link
```
## list 3 (display links by aliases)
```dataview
LIST WITHOUT ID link(file.outlinks, file.outlinks.aliases)
WHERE file.link = this.file.link
```