Creating a Dataview Query within a Template

Any ideas on how to create a dataview query within a templater template that will reference its own file name? I am trying to make a series of indexes that would just display a list of backlinks to the index. When creating a page that would link to a brand new index, I would in theory just be able to apply the “index template” that would already have a query typed out and auto-fill the “FROM” field with the name of the file.

Things I have tried

I have tried creating a template with

"

LIST
FROM [[tp.file.title]]

However this doesn’t seem to work.

What I’m trying to do

I’m in the wine business and trying to use Obsidian as a wine tasting journal. This way I can create a new file for each wine, and link to regions and subregions. That way I can look at an index for “California” and it will display all wines from California. Or “Napa Valley” which would then narrow the index to just wines from there, and exclude the rest of California. I’ve also considered using tags, but links seems more straightforward. This way when I try a wine from a new region, I can link the new region and apply the “index template” to the new page and have it auto populate with query results.

I

Please forgive me as I am obviously new to this. I tried

List
from [[]]

And the result returned was “query returned 0 results.”

Do I need to fill something in the link such as a templater file? I have tried:

tp.file.title

and dataview could not resolve the link. I’m looking for a way to automatically query links to the file, without having to manually insert the file name each time a new index is generated.

LIST
FROM [[]]

This is the most easy solution to achieve what you want.
I don’t think you need to use Templater resources to achieve this.
The dataview query above works with me. Relaunch obsidian and disable other plugins only to check if any issue extra-dataview.
In dataview syntax, FROM [[]] means «inlinks to this file», because it reads [[]] as «this file».
In your test with “query returned 0 results” are you sure you have inlinks in that note? (check backlinks pane)

Rebooting worked. Thanks for the help! I’ll get the hang of this soon :joy:

1 Like

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