NameGuard

approved

by toadfans

Strictly enforce vault-wide unique note names. Blocks new notes (and moves/renames) that would collide with an existing name, so shortest-format links are never silently rewritten. - This plugin has not been manually reviewed by Obsidian staff.

↓ 134 downloadsUpdated 1mo agoMIT

šŸ›”ļø NameGuard

Keep every note name unique — and stop Obsidian from silently rewriting your links.

Main Obsidian plugin Obsidian minimal version License


The problem

With Settings → Files and links → New link format set to Shortest path when possible, Obsidian keeps your [[wikilinks]] short only while a note name is unique. The moment a second note with the same name appears anywhere in the vault, Obsidian rewrites your existing links to keep them pointing at the original file:

- [[Foobar]]
+ [[notes/Foobar]]

You never touched those notes — yet your links changed, your git diff is noisy, and a careless undo can leave links resolving to the wrong file.

The fix

NameGuard treats a note name as a vault-wide unique key. When an operation would introduce a duplicate name, NameGuard blocks it before the file is created — so the rewrite never happens.

šŸ”‘ Pre-existing duplicates are left untouched. NameGuard only guards new collisions.

Feature
🚫Blocks duplicate creation — new notes, "create from link", and templates all run through one guard
šŸ”€Guards moves & renames — renaming a note into a name that's already taken is blocked too
šŸŽÆShortest-mode aware — only acts when it actually matters (configurable)
šŸ“Markdown-first — guards .md by default; opt in to every file type
🧩Zero config — sensible defaults, with a settings tab when you want control
šŸ”’100% local — no network, no telemetry

How it works (in one breath)

Obsidian's MetadataCache.fileToLinktext falls back to a full path once a name stops being unique, and FileManager rewrites the affected links right after a create/rename. NameGuard wraps the vault's create / createBinary / rename and rejects the operation when the new name already resolves to an existing note — so the trigger never fires.

šŸ“– Full write-up in docs/how-it-works.md.

Install

Manually

  1. Download main.js, manifest.json, and styles.css from the latest release.
  2. Copy them into <your-vault>/.obsidian/plugins/name-guard/.
  3. Reload Obsidian, then enable NameGuard under Settings → Community plugins.

From source

bun install
bun run build      # bundles main.js

Settings

NameGuard works with its defaults. Settings → NameGuard exposes only file-type scope and release note preferences; see the settings reference for details.

Documentation

For plugin developers

Search results and similarity scores are powered by semantic analysis of your plugin's README. If your plugin isn't appearing for searches you'd expect, try updating your README to clearly describe your plugin's purpose, features, and use cases.