Dataview: How to query for specific internal links

Hello everyone,

I am fairly new to Obsidian and am currently trying to sort my first notes using dataview.

I would like to create a list that shows me all notes in which a specific internal link appears.

Unfortunately, I have been unsuccessful so far.

I have tried the following variations of this approach so far:

table
FROM [[/]]
WHERE contains(file.text, "[[Obsidian]]")

I hope one of you has an idea and I’m just at a loss right now

Have you tried this:

TABLE
FROM ""
WHERE contains(text, link("Obsidian"))

These should work too:

TABLE
FROM ""
WHERE text = link("Obsidian")
TABLE
FROM ""
WHERE text = [[Obsidian]]

If the link is just somewhere in the text you need to do something like:

```dataview
LIST 
WHERE contains(file.outlinks, link("Obsidian"))
```

Where you also could use [[Obsidian]] instead of link().

Great! That worked perfectly fine :+1:
Thanks a lot!

This is useful, however I have a requirement I’d like to tack on, which may or may not be feasible, I’m not sure.

Background:

  1. I have Book notes stored in /Sources/Books/<book_title>.md
    In essence these are just filled with contents…
    ie: ## Index ## chapter 1 … etc

  2. In the front matter I also have a finished_date, which I fill in manually when I’m done reading.

  3. In my daily notes I keep track of what I’m reading inline as:

  • Read:: [[book_title#chapter 1|Book Title]] | Chapter Name

This way in the book note, I can look up in the links for what I read, what specific chapters and when.

If helpful, my daily note also hold the tag #periodic/daily as well as linking to the current monthly note as [[YYYY-MM]]

Requirement:
In my monthly note, I’d like a table. to show which books I completed this month.

I’d got as far as:

TABLE Read as Completed
FROM [[2024-02]] and #periodic/daily  
SORT file.name DESC

and now feel WHERE contains(file.outlinks, link("XXX")) might be the filter I need, but how do I first filter down links from the books folder + check if the finished_date is not null and is in this month?

Apologies if I’ve been unclear.

@jun6lee , please post request in separate threads.

1 Like

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