Skip to content

getBacklinksForFileOrPath

Retrieves the backlinks for a file or path. NOTE: The file may be non-existent.

When Advanced Metadata Cache publishes its backlinks API and its Backlinks module is on, its cache answers. Otherwise the answer comes from a backlink index whose cost is proportional to the candidate notes rather than to every reference in the vault, and which gives the same references Obsidian’s own getBacklinksForFile gives.

Import:

import { getBacklinksForFileOrPath } from '@mnaoumov/obsidian-lib/metadata-cache';

Signature:

function getBacklinksForFileOrPath(app: App, pathOrFile: PathOrFile): CustomArrayDict<Reference>

Parameters:

Parameter Type Description
app App The Obsidian application instance.
pathOrFile PathOrFile The path or file object.

Returns: CustomArrayDict<Reference> — The backlinks for the file.


Links to this page: