Skip to content

hasBacklinkCachePlugin

Determines whether a backlink cache plugin is currently loaded - either Advanced Metadata Cache (ADVANCED_METADATA_CACHE_PLUGIN_ID) or its retired predecessor Backlink Cache (BACKLINK_CACHE_PLUGIN_ID).

Such a plugin grafts a drain-on-read backlink index onto the metadata cache and indexes canvas metadata, so a caller that compensates for Obsidian’s own gaps can stand down while one is present. Both ids are recognized; BACKLINK_CACHE_PLUGIN_ID records when the retired one may be dropped.

This reads the LOADED plugin instance rather than app.plugins.enabledPlugins, deliberately: the question is whether the plugin’s patches are in place right now, and they are not until it has loaded. Plugins load in an unspecified order, so call this from a user-driven path rather than from plugin load - see rule L25 in AGENTS.md.

Import:

import { hasBacklinkCachePlugin } from 'obsidian-dev-utils/obsidian/metadata-cache';

Signature:

function hasBacklinkCachePlugin(app: App): boolean

Parameters:

Parameter Type Description
app App The Obsidian app instance.

Returns: boolean — true if a backlink cache plugin is loaded, otherwise false.


Links to this page: