The Hierarchy Plugin for Obsidian enhances your note-taking experience by visualizing the folder hierarchy of your markdown files directly within the editor. This plugin allows users to see subdirectory structures and modify how file titles are displayed in tabs and backlinks based on their file paths.
Once installed, the Hierarchy Plugin will:
To configure the plugin:
pages/ default adopts Obsidian's folder setting.Topic/Child also excludes Topic/Child/Leaf, but keeps Topic/Childish. A trailing slash is optional. A full file path such as pages/Topic/Child.md excludes just that note.Shortened labels always retain their original file destinations. Clicking an item opens that exact note, even if another folder has a note with the same name. Clicking a missing ancestor creates an empty note at its full hierarchy path. Cmd/Ctrl-click and middle-click follow Obsidian's new-tab behavior.
Each editor retains its hierarchy expansion state during refreshes and editor DOM replacement. Closing an editor or unloading the plugin releases its React root. Backlink settings apply immediately to already displayed linked and unlinked mentions; disabling the setting or unloading the plugin restores their original titles while preserving later edits by other plugins.
Open hierarchies refresh when notes are created, renamed, or deleted. Backlink titles preserve dots in folder and file names and omit only the final file extension.
If you prefer using paths over tags (like I do), I recommend using Obsidian Linter.
When you use Obsidian's autocomplete feature to insert paths, it often automatically adds aliases to the links. You can prevent this by using the following regular expressions:
\[\[([^\|\[\n]+)\|([^\|\[\n]+)\]\]gm[[$1]]Additionally, I store all my pages under the pages/ directory, but I don’t want to start every link with pages/. To avoid this, I use the following setting:
\[\[pages/([^\|\[\n]+)\]\]gm[[$1]]This setup will clean up both aliases and the pages/ prefix, leaving a simple and clean path for your links.
ref. https://platers.github.io/obsidian-linter/settings/custom-rules/#custom-regex-replacements
Run the development checks with:
npm test
npm run build
npm run lint
The tests use Node's built-in test runner and the existing esbuild dependency. Backlink tests run the actual patching code and monkey-around, replacing only Obsidian's runtime classes. Hierarchy tests replace the React DOM host while exercising real JSX, path selection, navigation, settings migration, and static HTML output. Visual behavior and click handling should also be checked in Obsidian.
To bump the version, run npm version patch or npm version minor or npm version major. This will bump the version in package.json, create a new git tag, and push the changes to the repository.
Contributions are welcome! If you have ideas, feature requests, or bug reports, feel free to open an issue or submit a pull request.
Some code around the backlinks are inspired by the Owner avatar better-search-views .
This plugin is open-source and available under the MIT License.