File.outlinks not finding header links

What I’m trying to do

I am new to Obsidian (247 notes) but am absolutely loving it! its changed my life! :slight_smile:

I have a note called “I am, People are”
Inside it I have a link to another note [[Learning Index#Master Yr2|second year]]
I am using this link so I link it as text in the sentence, its not the files alias.

In the note “Learning Index”
I have 2 dataview blocks
I want it to show the link to “I am, People are”

This one works:

LIST
FROM -"Templates" AND [[Learning Index]]
WHERE type != "moc" AND !contains(file.inlinks, this.file.link)
SORT file.name ASC

But this one doesnt

LIST
FROM -"Templates"
WHERE type != "moc" AND contains(file.outlinks, this.file.link) AND !contains(file.inlinks, this.file.link)
SORT file.name ASC

If I put a link into “I am, People are” manually as [[Learning Index]] then the second block works as well.
I want the second block to show the link without having to manually add the link like above.
I would like to use this code block because it is more automated than the first and if I replicate it around other notes I don’t have to manually enter anything into it I can just cut and paste it :slight_smile:

Thanks so much

Things I have tried

I am guessing the “contains” is looking for [[Learning Index]] and its the ]] that are the problem as [[Learning Index#Master Yr2|second year]] doesn’t strictly contain it, however I’m at a loss to how the first block is working as its basically the same thing i.e. [[Learning Index]] = this.file.link

What worries me is in the right outlinks panel of Obsidian it doesn’t show the note name for the outlink but the Header name

I have read through the dataview syntax manuals but I’m at a loss where to go from here?

Thanks for any help

So I figured out a solution, well a couple in fact. I thought I would post it here just in case it can help anyone else :slight_smile:

You can enable “back links in document” from the menu of any note however this doesn’t have a filter in it so shows every back link which isn’t good for my use case because I’m mainly doing this so I can find notes I attached to the note, usually in haste when I’m jotting something down and quickly referenced the link

The second was this:

LIST
FROM -"Templates" AND [[#]]
WHERE type != "permenant" AND !contains(file.inlinks, this.file.link)
SORT file.name ASC

Which works perfectly :slight_smile:
[[#]] is a source that looks at the current file like this.file.link but it can be used in the FROM line
and it removes the need for contains(file.outlinks, this.file.link) in the WHERE field

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