Skip to content

getIndexedBacklinksForFile

The same answer as app.metadataCache.getBacklinksForFile(file) (Obsidian’s own, unpatched), from the candidate notes only. See the file header for why the answer is exact.

Import:

import { getIndexedBacklinksForFile } from 'obsidian-dev-utils/obsidian/backlink-index';

Signature:

function getIndexedBacklinksForFile(app: App, file: TFile): CustomArrayDict<Reference>

Parameters:

Parameter Type Description
app App The Obsidian app instance.
file TFile The file whose backlinks to find. It may be a non-existing file registered for the query.

Returns: CustomArrayDict<Reference> — The references that resolve to file, keyed by the path of the note or canvas holding them.