Skip to content

A powerful Obsidian plugin for template management with multi-select, categories, favorites, frontmatter editing, and folder creation.

License

Notifications You must be signed in to change notification settings

Real-Fruit-Snacks/template-picker

Repository files navigation

Template Picker for Obsidian

A powerful template management plugin for Obsidian that provides a modal interface for selecting and creating notes from templates. Features multi-select support, categories, favorites, frontmatter editing, nested folder creation, and more.

Features

Core Functionality

  • Multi-select templates - Select multiple templates at once and create all notes in a single action
  • Destination folder selection - Choose where to create your notes with autocomplete suggestions
  • Template categories - Organize templates into collapsible groups
  • Favorites & Recent - Quick access to starred templates and recently used ones
  • Search & Sort - Find templates quickly with search and multiple sorting options

Template Organization

  • Categories - Group templates by type (Work, Personal, Projects, etc.)
  • Category colors - Assign colors to categories for visual distinction (9 color options)
  • Collapsible sections - Collapse/expand categories to focus on what you need
  • Expand/Collapse All - Quickly expand or collapse all sections with one click
  • Select All/Deselect All - Bulk selection within categories, Favorites, or Recent sections
  • Custom ordering - Sort by category, alphabetically (A-Z or Z-A), or custom order

Smart Features

  • Frontmatter editing - Edit template frontmatter values before creating notes
  • Field sync - Sync same-named fields across multiple templates
  • Subfolder creation - Automatically create subfolders (including nested paths) for specific templates
  • Auto-tracking - Templates automatically update when source files are moved/renamed
  • Duplicate handling - Skip, increment filename, or overwrite existing files
  • Path sanitization - Automatically sanitizes filenames to remove invalid characters
  • Double-click protection - Prevents accidental duplicate note creation

Access Methods

  • Ribbon icon - Click the file-plus icon in the left sidebar
  • Command palette - Use "Open Template Picker" command
  • Hotkey - Assign a custom keyboard shortcut
  • Right-click menu - Right-click any folder to add templates there

Installation

From Obsidian Community Plugins

  1. Open Obsidian Settings
  2. Go to Community Plugins and disable Safe Mode
  3. Click Browse and search for "Template Picker"
  4. Click Install, then Enable

Manual Installation

  1. Download the latest release (main.js, manifest.json, styles.css) from the Releases page
  2. Create a folder called template-picker in your vault's .obsidian/plugins/ directory
  3. Copy the downloaded files into the template-picker folder
  4. Enable the plugin in Obsidian's Settings > Community plugins

File Structure

your-vault/
└── .obsidian/
    └── plugins/
        └── template-picker/
            ├── main.js
            ├── manifest.json
            └── styles.css

Usage

Opening the Template Picker

Option 1: Ribbon Icon Click the file-plus icon in the left sidebar (can be disabled in settings)

Option 2: Command Palette

  1. Press Ctrl/Cmd + P to open the command palette
  2. Type "Template Picker"
  3. Select "Open Template Picker"

Option 3: Hotkey

  1. Go to Settings > Hotkeys
  2. Search for "Template Picker"
  3. Assign your preferred keyboard shortcut

Option 4: Right-Click Menu

  1. Right-click any folder in the file explorer
  2. Select "Add templates here"
  3. The picker opens with that folder pre-selected as the destination

Selecting Templates

  1. Click to select - Click any template button to toggle selection (turns blue when selected)
  2. Multi-select - Select as many templates as you need
  3. Select All in category - Click "Select All" in a category header to select all templates in that category
  4. Select All in Favorites/Recent - Each special section also has Select All/Deselect All buttons
  5. Expand/Collapse All - Use the buttons to expand or collapse all sections at once

Creating Notes

  1. Select one or more templates
  2. Enter or select a destination folder (with autocomplete)
  3. Click "Create Notes"
  4. If templates have frontmatter, fill in the values (or click "Skip & Use Defaults")
  5. Notes are created in the destination folder

Using Favorites & Recent

Favorites Section

  • Appears at the top of the modal when you have favorited templates
  • To add favorites: Go to Settings > Template Picker > Existing Templates and click "☆ Favorite" on any template
  • Favorites appear in both the Favorites section AND their normal category
  • Includes Select All/Deselect All button for quick bulk selection
  • Can be disabled in settings

Recent Section

  • Shows your last 5 used templates (excluding favorites)
  • Automatically updates when you create notes
  • Great for quickly accessing frequently used templates
  • Includes Select All/Deselect All button for quick bulk selection
  • Can be disabled in settings

Settings

General Settings

Setting Description
Show ribbon icon Toggle the sidebar icon on/off
Default destination folder Pre-fill destination when opening the picker
Auto-open created notes Automatically open notes in the editor after creation
Duplicate file handling What to do when a file already exists: Skip, Add number suffix, or Overwrite
Default sync state Default state for "Sync same-named fields" toggle
Skip frontmatter form Skip the form entirely and use default frontmatter values
Default sort order How templates are sorted: By Category, A-Z, Z-A, or Custom
Show Favorites section Enable/disable the Favorites section in the picker
Show Recent section Enable/disable the Recently Used section in the picker
Start with categories collapsed When enabled, all categories start collapsed when opening the picker

Template Configuration

Each template has the following properties:

Property Description
Button Name Display name shown in the picker (must be unique)
Category Group for organizing templates (default: "Uncategorized")
Subfolder Optional subfolder created within destination (supports nested paths like Projects/2024)
Note Path Path to the template note in your vault
Favorite Toggle to add/remove template from Favorites section

Category Colors

Assign colors to categories for visual organization:

  • Red, Orange, Yellow, Green, Teal, Blue, Purple, Pink, Gray
  • Colors appear as left borders on category headers and template buttons
  • Set in the "Category Colors" section at the bottom of settings

Template Setup Guide

Adding a New Template

  1. Create your template note in your vault (e.g., Templates/Meeting Notes.md)
  2. Go to Settings > Template Picker
  3. Under "Add New Template":
    • Button Name: Enter a unique display name (e.g., "Meeting Notes")
    • Category: Enter a category (e.g., "Work")
    • Subfolder: (Optional) Enter a subfolder name or path
    • Note Path: Start typing and select your template note
  4. Click "Add Template"

Note: Template names must be unique. The plugin will warn you if you try to add a duplicate name.

Editing Templates

  1. Go to Settings > Template Picker
  2. Find the template under "Existing Templates"
  3. Click "☆ Favorite" to add/remove from Favorites section
  4. Click "Edit" to modify:
    • Button name (must remain unique)
    • Category
    • Subfolder
    • Note path
  5. Click "Delete" to remove the template

Note: When you rename a template, it automatically updates in Favorites and Recent lists.

Template with Frontmatter

If your template has YAML frontmatter, the plugin will detect editable fields:

---
title:
date:
project:
status: draft
url: https://example.com
---

# Meeting Notes

...

When you select this template, you'll be prompted to fill in the frontmatter values before the note is created.

Supported frontmatter formats:

  • Simple key-value pairs: key: value
  • Quoted strings: key: "value with: colons" or key: 'single quoted'
  • URLs and values with special characters are handled correctly

Not supported (skipped in the form):

  • Arrays: tags: [one, two, three]
  • Multi-line values: description: |
  • Nested objects
  • List items starting with -

Using Subfolders

Subfolders are useful for templates that should always create their own directory:

Example 1: Simple subfolder

  • Template: "New Project" with subfolder set to "Projects"
  • Destination: Work/2024
  • Result: Work/2024/Projects/New Project.md

Example 2: Nested subfolder

  • Template: "Client Meeting" with subfolder set to "Clients/Meetings"
  • Destination: Work
  • Result: Work/Clients/Meetings/Client Meeting.md

The subfolder path is created automatically if it doesn't exist, including all intermediate folders.

Advanced Features

Field Sync

When selecting multiple templates with frontmatter:

  1. The "Fill in Template Details" form appears
  2. Enable "Sync same-named fields across all templates"
  3. When you edit a field (e.g., "project"), all templates with that field update together

Use case: Creating multiple related notes that should share the same project name, date, or author.

Automatic Path Tracking

The plugin automatically handles file movements:

  • Template moved/renamed: Path updates automatically in settings
  • Template deleted: Warning notification appears listing affected template buttons
  • Missing templates on startup: Notification lists affected templates so you can update them

Search & Filter

Use the search box to find templates:

  • Searches template button names
  • Searches category names
  • Results update in real-time
  • Special sections (Favorites, Recent) are hidden during search

Sorting Options

Sort Mode Behavior
By Category Groups templates by category with collapsible sections
A → Z Alphabetical order (ascending), flat list
Z → A Alphabetical order (descending), flat list
Custom Order Templates appear in the order they were added

Keyboard Shortcuts

Action Default Customizable
Open Template Picker None Yes (Settings > Hotkeys)
Close modal Escape No

Tips & Best Practices

Organizing Templates

  1. Use meaningful categories - Group by project, type, or frequency of use
  2. Favorite frequently used templates - They appear at the top for quick access
  3. Use category colors - Visual distinction helps find templates faster
  4. Keep template names concise - They appear on buttons with limited space

Template Design

  1. Use frontmatter for variable data - Dates, names, statuses, project names
  2. Use simple key-value frontmatter - Complex YAML structures won't be editable
  3. Use subfolders for project templates - Keeps related files together
  4. Consider naming conventions - Template button names become filenames

Workflow Tips

  1. Right-click folders - Fastest way to add templates to a specific location
  2. Set a default destination - Saves time if you usually create notes in one place
  3. Enable auto-open - Immediately start editing new notes
  4. Use field sync - When creating multiple related notes, sync common fields
  5. Collapse categories by default - If you have many templates, start collapsed for cleaner view

Troubleshooting

Template not found

  • Template buttons show a warning icon (⚠) when the template file cannot be found
  • This visual indicator helps you quickly identify missing templates in the picker
  • The plugin shows a notification on startup listing missing templates
  • Go to Settings and update the note path, or delete the template entry

Frontmatter not detected

  • Ensure frontmatter is at the very start of the file (no blank lines before ---)
  • Format must be valid YAML between --- markers
  • Complex YAML (arrays, nested objects) is skipped - only simple key-value pairs are shown

Frontmatter fields not appearing

  • A warning banner appears at the top of the frontmatter form showing which fields were skipped
  • Arrays and list items are not shown in the form
  • Multi-line values (| or >) are not shown
  • Nested/indented structures are skipped
  • Only top-level simple key-value pairs are editable

Modal too small

  • The modal is set to 90% viewport width (max 800px)
  • If content is cut off, try reducing font size in Obsidian
  • The template list area scrolls independently

Dropdown cut off

  • Dropdowns use fixed positioning to avoid clipping
  • If issues persist, try scrolling the modal or page

Duplicate template names

  • Template names must be unique
  • The plugin prevents adding or renaming to duplicate names
  • Check existing templates in settings if you get a duplicate warning

Folder not created

  • The plugin creates nested folder paths automatically
  • Check that you have write permissions in the vault
  • Folder names are sanitized (special characters like <>:"/\|?* are replaced)

Technical Notes

File Safety

  • Filenames are automatically sanitized to remove invalid characters
  • Invalid characters (< > : " / \ | ? *) are replaced with -
  • Multiple spaces are collapsed to single spaces

Performance

  • Event listeners are properly cleaned up when modals close
  • Double-click protection prevents accidental duplicate submissions with automatic recovery
  • Unique filename generation has a safety limit of 1000 attempts

Data Integrity

  • Template selections use names (not array indices) for reliability
  • Renaming templates automatically updates Favorites and Recent lists
  • Deleted templates are removed from Favorites and Recent
  • Only successfully created notes are tracked in Recent (partial failures are handled gracefully)
  • Importing settings automatically cleans up orphaned references to deleted templates

Version History

1.3.2

  • Verification audit fixes
  • Enhanced import validation for folder templates
  • Fixed edge cases in file path handling
  • Improved error handling throughout

1.3.1

  • Major code refactoring with TemplateSelector helper class
  • Implemented event delegation for better performance
  • Eliminated ~400 lines of duplicated code between modals

1.3.0

  • Added plugin lifecycle management (onunload cleanup)
  • Fixed document click handler accumulation
  • Added TTL-based folder cache invalidation
  • Added Platform.isMobile checks for mobile compatibility
  • Added path traversal validation for security
  • Enhanced error handling with standardized helper function
  • Added import file size limit (5MB)
  • Updated CSS to use theme variables
  • Added focus states for accessibility

1.2.0

  • Added folder templates support
  • Added hover preview for templates
  • Added Template Manager modal for bulk operations
  • Improved mobile compatibility

1.1.0

  • Added nested folder creation support
  • Added path/filename sanitization for safety
  • Added double-click protection on create buttons
  • Added duplicate template name validation
  • Added automatic Favorites/Recent update when templates are renamed
  • Improved YAML frontmatter parsing (handles URLs, quotes, skips complex structures)
  • Improved regex escaping for frontmatter field replacement
  • Fixed memory leaks from document event listeners
  • Fixed potential issues with template selection using array indices
  • Added safety limit to unique filename generation

1.0.0

  • Initial release
  • Multi-select template picker
  • Categories with colors
  • Favorites and recent templates
  • Frontmatter editing with field sync
  • Subfolder support
  • Search and sorting
  • Automatic path tracking
  • Right-click folder integration

Support

For bugs, feature requests, or questions:

  • Open an issue on the GitHub repository
  • Include steps to reproduce any bugs
  • Describe your Obsidian version and operating system

License

MIT License - see LICENSE file for details.

About

A powerful Obsidian plugin for template management with multi-select, categories, favorites, frontmatter editing, and folder creation.

Topics

Resources

License

Stars

Watchers

Forks