How to return inline fields which contain text in a linklink

I have inline fields in the following format:

field1:: [[link1]], [[link2]]
field2:: #tag
field3::  some_text

I am attempting to pull a dataview to return files which have field2 = "[[link1]]" but I can’t get it to work.

Things I have tried

TABLE field1 FROM ""
WHERE contains(field1, "link1")
TABLE field1 FROM ""
WHERE field1 = "[[link1]]"
TABLE field1 FROM ""
WHERE regexmatch("link1", field1)

I can get this to work without issue with field2 and field3. Is it failing because field1 is a link?

(edits for clarity that these are “inline fields”


[[link1]], [[link2]] is invalid YAML.

You could—in theory—use [[[link1]], [[link2]]] (check) but that looks complicated and for some odd reason is rejected by Obsidian as being invalid.

EDIT: That was wrong, I made a type there, it is accepted by Obsidian.

Thanks. Maybe I’m missing something, but these are inline fields within the body of the file, not in the YAML front-matter as described here

Ah ok. I don’t use the so-called inline fields because they make typography look wrong and are complicated to handle and non-standard. So I can’t tell you if that could work. I suppose not, because I assume those are also handled by a YAML parser.

One reason for that syntax being so hard to use (with YAML, while being easy for humans) is that the “wikilinks” appear to a YAML parser as an “array within an array”.

Let me do some more tests. You only want to find text that could be in the whole field1, right?

It would appear if you make the links a YAML str type, like in

field1: "[[link1]], [[link2]]"

you can do a Dataview search without sacrificing the wikilinks:

table field1 from ""
where contains(field1, "[[link1]]")



Doesn’t look good, but at least works …

yes. the goal is to be able to query for files which have either [[link1]] or [[link2]] associated with field1.

Your comment about YAML parsing, led me to try enclosing the entire line in double-quotes. Which did work. However, it’s odd to read the document that way so I’m hoping there’s a better option

Two people, same idea :grin:

Thanks for pointing me in the right direction, appreciate it.

1 Like

I think I found a way. Would you like to try?

# Test Dataview Inline Links

field1:: [[link1]], [[link2]]

field2:: #testtag

field3:: a, b



Does _not_ work:

table field1 from ""
where contains(field1, "[[link1]]")


table field1 from ""
where contains(field1, [[link1]])

Be warned that if anything else is on the links line, like an external link

field1:: [[link1]], [[link2]], [External](

or anything else

field1:: [[link1]], [[link2]], abc

the whole construct breaks and the top dataview starts working, while the lower one fails. So quite a shaky solution …

1 Like

Struggling with this as well. Appreciate these examples, but I can’t get either of these approaches to work for me (query returned 0 results) when my field just has one value … eg. themes:: [[Device Quality]] … 0 results

I tried faking making a list … themes:: [[Device Quality]], dummy… and it works using either contains(themes, "[[Device Quality]]") or contains(themes, "Device Quality") or contains(themes,

… but NOT for the link directly as in contains(themes, [[Device Quality]]).

The more I play around, I seem to be stumped on the singular item (non-list) field value when it is a link specifically.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.