Auto Frontmatter on Folder Structure

unlisted

by Pine885

Automatically tags notes and creates structural links (siblings, parents, children) based on folder hierarchy.

Updated 2mo agoGPL-3.0
View on GitHub

Auto Frontmatter Notes by Folder Structure

Obsidian plugin that transforms your folder hierarchy into a rich network of automated tags and structural links within your note frontmatter.

๐ŸŒŸ Overview

Instead of manually managing tags and links, this plugin treats your folder structure as a source of truth. It automatically generates metadata that describes where a note lives, who its neighbors are, and how it relates to the broader vault architecture.

โœจ Key Features

๐Ÿท๏ธ Automatic Path-based Tagging

Convert your folder paths into a clean set of tags.

  • Dynamic Hierarchy: Automatically generates tags based on the folder path.
  • Configurable Depth: Use Tag Depth to control how many levels of the hierarchy are converted into tags (e.g., 1 for the immediate parent, 2+ for a deeper ancestral chain).

๐Ÿ”— Multi-Depth Structural Linking

Create a web of relationships between notes based on their physical location in the vault.

  • Parents: Links to notes in parent folders.
  • Siblings: Links to other notes in the same folder.
  • Children: Links to notes in subfolders.
  • Cousins (Dynamic Relationships): Define custom relationships by adding a FolderName-[R] key. The plugin will find all folders with that name across your entire vault and link the notes within them.
  • Strict Sorting: Keys are always organized in a logical order: Parents $\rightarrow$ Siblings $\rightarrow$ Children $\rightarrow$ Cousins.

๐Ÿ“ Intelligent Folder Summaries

Bring folder-level context directly into your notes.

  • Automatic Extraction: The plugin looks for a summary.md file (or similar) in a folder and extracts its content.
  • Smart Detection: Uses a priority-based search: Exact Match $\rightarrow$ Starts With $\rightarrow$ Ends With $\rightarrow$ Contains.
  • Clean Text: Automatically strips YAML frontmatter and markdown formatting to provide a clean, plain-text summary.
  • Comprehensive Coverage: Summaries are available for Parents, Siblings, Children, and Cousins.

โšก High-Performance Automation

Designed for large vaults and seamless workflows.

  • Real-time Triggers: Updates are triggered automatically when notes are moved, renamed, deleted, or opened.
  • Pro Queue Architecture: Uses a debounced batch processing system to prevent UI lag and avoid sync loops with cloud services (iCloud/Dropbox).
  • Configurable Delay: Adjust the Update Delay to balance responsiveness and CPU usage.
  • Dirty Checking: Only writes to the file if the calculated metadata actually differs from the current frontmatter, minimizing disk I/O.

๐Ÿงน Maintenance & Safety

  • Ghost Key Removal: Automatically detects and deletes obsolete structural keys when folders are renamed or moved.
  • Folder Targets: Precisely control which notes are processed using Whitelist and Blacklist filters.
  • Vault-Wide Wipe: A "Clear All Frontmatter" utility for a fresh start.

โš™๏ธ Configuration Guide

Main Settings

  • New User Guide: A quick start guide to help you configure the plugin.
  • Quick Run: A button to immediately process all files in your vault.
  • Ribbon Visibility: Toggle which quick-access icons appear in your Obsidian ribbon:
    • Run Auto-Frontmatter: Process all files.
    • Auto-Frontmatter Active Note: Process only the current file.
    • Clear All Frontmatter: Wipe all structural metadata from the vault.
    • Clear Active-Note Frontmatter: Wipe metadata from the current file.
  • Folder Targets: Precisely control which notes are processed using Whitelist and Blacklist filters.
    • Whitelisted Folders: Only process notes in these folders. If left empty, the plugin targets all folders in your vault.
    • Blacklisted Folders: Completely ignore specific directories (e.g., Archive, Templates) to keep your metadata clean.
  • Clear Frontmatter: A utility to remove all automated frontmatter properties for a fresh start.

Automation Settings

  • Enable Automation: Toggle real-time updates.
  • Update Delay: Time (ms) to wait before processing the queue. Lower = faster, Higher = lighter on CPU.

Auto Tag Settings

  • Enable Tagging: Toggle path-to-tag conversion.
  • Tag Depth: 0 = Clear tags, 1 = Immediate parent, 2+ = Hierarchy.

Auto Link Settings

  • Enable Linking: Toggle structural linking.
  • Link Depth: 0 = Cousins only, 1 = Siblings + Cousins, 2+ = Hierarchy + Siblings + Cousins.
  • Cousin Links: Add FolderName-[R]: to your properties to link all notes in any folder named FolderName across your vault. This will also automatically add #FolderName to your tags.

Summary Settings

  • Enable Summary: Toggle folder summary extraction.
  • Full Text: If disabled, only the first paragraph is used.
  • Strict Summary Name: If enabled, only files named exactly "summary" are used.
  • Detection Priority: The fixed hierarchy used to find summary files.

๐Ÿ“– Frontmatter Reference

SuffixMeaningDescription
-[TP n]Parent SummarySummary of the parent folder at depth n.
-[P n]Parent (Level n)Link to the note in the parent folder at depth n.
-[TS]Sibling SummarySummary of the current folder.
-[S]SiblingsLinks to other notes in the same folder.
-[TC n]Child SummarySummary of the subfolder at depth n.
-[C n]Child (Level n)Links to notes in subfolders at depth n.
-[TR]Cousin SummarySummary of the cousin folder.
-[R]CousinsLinks to notes in any folder with the specified name.

๐Ÿ“ Example

Scenario: A note located at Projects/Active/Work/Task.md

  • Tag Depth: 2
  • Link Depth: 2
  • Cousin Key: Resources-[R] added manually.

Resulting Frontmatter:

tags:
  - #Active
  - #Work
Projects-[TP2]: "The main project hub."
Projects-[P2]: [[Project Root]]
Active-[TP1]: "Current active projects."
Active-[P1]: [[Active Folder Note]]
Work-[TS]: "Work-related tasks and notes."
Work-[S]: [[Note A], [Note B]]
Work-[TC1]: "Detailed sub-task breakdown."
Work-[C1]: [[Sub-task 1], [Sub-task 2]]
Resources-[TR]: "Global resource library."
Resources-[R]: [[Resource A], [Resource B]]

๐Ÿš€ Installation

Manual Installation

  1. Download main.js and manifest.json.
  2. Create a folder .obsidian/plugins/obsidian-auto-frontmatter in your vault.
  3. Place the files inside and restart Obsidian.

For Developers

  1. Clone the repository.
  2. Run npm install.
  3. Run npm run build to compile TypeScript to main.js.

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.