• Home >
  • Notes >
  • Get all links to the current file with Obsidian and Dataview

Get all links to the current file with Obsidian and Dataview

Dataview is easily one of the most powerful plugins for Obsidian.

One of my favorite ways to use Dataview is to get all of the files that are linked to the current file.

This lets the user embed linked mentions in the document instead of having to use the "Linked Mentions" section of the Obsidian UI.

using the dataview tag:

dv.list(
dv.pages(`[[${this.currentFilePath}]]`)
	.map(page => [page.file.link]))

The Result:

This is helpful if you don't need to see where the file is mentioned and instead just want to see an overview of all the files that link to it.

Update 2022-11-25

I've started taking interstitial notes and leveraging a Dataview (Obsidian) query that gets all list items that match the query for the current file:

dv.table(["Notes"],
	dv.pages().file.lists
		.where(li => li.text.includes(`[[${dv.current().file.name}]]`))
		.map(li => [li.text]))

This lets me easily capture my atomic thoughts, tasks and feelings in a daily note (I have a Quick Add workflow for each type that makes it fast) and then collect all of those thoughts, tasks and feelings in the note that it's relevant for.

As an example, today I worked on updating all of my 404 links to point to their 200 equivalent notes in curiouslychase.com. I capture all of my tasks, ideas, thoughts and feelings in my interstitial notes and then use the query above to render something like this in the note:

Published on 2022-07-26

Note Explorer