Convert a Dataview list with into internal links using Templater

Hello,

unfortunately, I’m not making progress with my problem and I don’t know enough about it. That’s why I could use your knowledge.

What I’m trying to do

I’m trying to convert a DataView list with linked notes into internal links using Templater.

For listing in DataView, I’m using the following:

LIST from [[]] and !outgoing([[]]) 
SORT date DESC
LIMIT 8

With Templater, this list should then be converted into internal links.

Things I have tried

I know that, for example, the following script works for Templater when listing tags:

<%*
const dv = app.plugins.plugins[“dataview”].api;
const query = ‘list From #type/recipe’;
let out = await dv.queryMarkdown(query)
tR += out. Value
%>

I have adapted this script:
<%*
const dv = app.plugins.plugins[“dataview”].api;
const query = 'LIST from [] and !outgoing([]) SORT date DESC LIMIT 8 ';
let out = await dv.queryMarkdown(query)
tR += out. Value
%>

However, it seems to refer to the template itself and not to the note where I apply it. So, it doesn’t display anything.

What do I need to do for Templater to dynamically apply [] to the desired note?
Insert and define tp.file.title in []?

Thank you very much for your help.

If someone in the future is still looking for an answer, @Joschua was able to help me find one.

<%* const dv = app.plugins.plugins["dataview"].api;
const fileTitle = tp.file.title;
const query = `LIST from [[${fileTitle}]] and !outgoing([[${fileTitle}]])`; 
const out = await dv.queryMarkdown(query);
tR += out. Value;
%>

In this context, I also found his blog post very helpful.

Thank you very much!

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