If you need a way to present all mentions of a given note inside it, here’s how I do it:
In the gathering note place this code:
> [!Quote] Timeline of mentions
> `$=await dv.view("code/mentions")`
Go to your Obsidian vault folder, make a code
folder and create there a file called mentions.js
. Put this code in the file:
const this_path = dv.current().file.path
function containsMention(list) {
for (let outlink of list.outlinks) {
if (dv.page(outlink.path) && dv.page(outlink.path).file.path == this_path) return true;
}
return false;
}
let mentions = dv.pages('#daily AND "journal" AND [[#]]').where(t => t.file.lists.length > 0).file.lists.where(l => containsMention(l)).groupBy(t => t.path).sort(k => k.key, 'desc')
dv.header(4, mentions.length + " dailies")
for (let group of mentions) dv.taskList(group.rows)
The code finds all mentions of a note if it matches all these criteria:
- the file is a daily note, that is:
- it sits in the
journal
folder - it has a
#daily
tag in its meta-data
- it sits in the
- the mention follows this syntax:
- [[your note]]
- stuff you want to mention
- more stuff to mention
or just
- [[your note]] blah blah
For anyone wandering why not look for headers instead of lists, it’s currently impossible with dataview to parse outlinks in headings.