Backlink Cache

by mnaoumov
Score: 62/100
Description
Category: File Management

The Backlink Cache plugin is a game-changer for Obsidian users with large vaults, as it significantly speeds up the performance of the Backlinks Pane and plugins that rely on backlinks. By maintaining a cache of backlinks, this plugin reduces the time it takes to retrieve link information, making navigation and discovery much faster. Whether you're a power user or a developer creating plugins, Backlink Cache is an excellent addition to your Obsidian setup, allowing you to work more efficiently and effectively with your notes.

Stats
34
stars
11,934
downloads
0
forks
589
days
16
days
16
days
1
total PRs
0
open PRs
0
closed PRs
1
merged PRs
5
total issues
0
open issues
5
closed issues
110
commits
README file from

Backlink Cache

This is a plugin for Obsidian that maintains backlink cache to speed up undocumented app.metadataCache.getBacklinksForFile function.

It's mostly useful for users with the large vaults. On smaller vaults the difference might be unnoticeable.

It speeds up Backlinks Pane performance and plugins that deal with the backlinks.

This plugin the most likely will be useful for other plugin developers that deal with the backlinks.

Its idea came from the forum.

Also the plugin includes canvas into the backlinks for the referenced files. This includes the app.metadataCache.getBacklinksForFile function and the Backlinks Pane.

Usage

Fast version

The provided version is faster than the built-in version. Also the overload to accept path was added.

const backlinks1 = app.metadataCache.getBacklinksForFile(file);
const backlinks2 = app.metadataCache.getBacklinksForFile(path);

Safe version

If you want to ensure the all recent file changes are processed and the backlinks are 100% accurate.

const backlinks1 = await app.metadataCache.getBacklinksForFile.safe(file);
const backlinks2 = await app.metadataCache.getBacklinksForFile.safe(path);

Original version

You can access the original built-in version:

const backlinks = app.metadataCache.getBacklinksForFile.originalFn(file);

TypeScript typings

If you want to use the updated functions from your plugin, you can copy types.d.ts into your code.

The plugin handles links from the canvas file/text cards if Canvas core plugin is enabled.

The plugin speeds up the Backlinks panel if Backlinks core plugin is enabled.

The plugin includes backlinks from the frontmatter markdown links if Frontmatter Markdown Links community plugin is enabled. Example of such link:

---
key: "[title](path/to/link.md)"
---

Installation

The plugin is available in the official Community Plugins repository.

Beta versions

To install the latest beta release of this plugin (regardless if it is available in the official Community Plugins repository or not), follow these steps:

  1. Ensure you have the BRAT plugin installed and enabled.
  2. Click Install via BRAT.
  3. An Obsidian pop-up window should appear. In the window, click the Add plugin button once and wait a few seconds for the plugin to install.

Debugging

By default, debug messages for this plugin are hidden.

To show them, run the following command:

window.DEBUG.enable('backlink-cache');

For more details, refer to the documentation.

Support

Buy Me A Coffee

License

Ā© Michael Naumov