DataviewJS Snippet Showcase

I got into studying Norse mythology and history last year, which resulted in a ton of pages for various people, terms, what have you. I also imported a lot of Norse text and translations into Obsidian. It got a bit wide and crazy at times. Especially since a lot of info wasn’t sourced from the original text, but references to references.

So I wrote this footer to add to my notes, which makes sure that any links to the page from original (or translated) text gets highlighted if I haven’t already referenced it on the page. That way the original source material gets the spotlight rather than just relying on general backlinks, and whenever I see an “unlinked attestation”, I’ll click in on the note and see exactly what the source material said, which helps me fill out my knowledge about the topic.

Each page has the following at the end:

```dataviewjs
dv.view("00 Meta/Javascript/query_attestations")
```

And query_attestations contains:

let pg = dv.current();

if (dv.pages("#📖").where(b => b.file.outlinks.includes(pg.file.link)).where(b => !pg.file.outlinks.includes(b.file.link)).length > 0) {
    dv.header(2, "Unlinked attestations");
    dv.list(dv.pages("#📖")
        .where(b => b.file.outlinks.includes(pg.file.link))
        .where(b => !pg.file.outlinks.includes(b.file.link))
        .file.link
    );
}
4 Likes