Templater icon indicating copy to clipboard operation
Templater copied to clipboard

Support Subfolders of Templates

Open acook opened this issue 9 months ago • 3 comments

Problem Statement

When I tried to put some of the templates into a subfolder I noticed that all subfolders were collapsed into a flat list, losing the namespacing and mixing everything up.

Context

I have several templates and some of them are only used for folder templates (like everything in the reference/software folder uses the software template), some are almost only used as includes (like default frontmatter contents), some are tiny snippets (like a link to today's daily note), and some are big templates that I use ad hoc (like whole note structures, such as an outline for every technology note).

I use includes and ad hoc templates to build fully formed folder templates which it often makes sense that the folder template and ad hoc template have similar names.

Seeing a bunch of templates that I basically never use when inserting from the command/button is kinda frustrating, especially since some of them are naturally very similarly named.

Proposed Solution

I would love to be able to namespace the templates in subfolders. Then subfolders would be "collapsed" in the Insert Template dialog - you would only see the name of the subfolder, not its contents until you typed part of the name with a slash at the end. Ideally they would also be listed at the end to further prioritize top level templates.

Example

Given folder structure:

templates/

  • A Commonly Used Template.md
  • Software.md
  • Snippets/
    • Daily Note Link.md
  • Folder Notes/
    • Software.md
  • Includes/
    • Default Frontmatter.md

The dialog would first appear like:

A Commonly Use Template
Software
---
Folder Notes/
Includes/
Snippets/

Then, when you type s/:

Snippets/Daily Note Link

Alternatives

Currently I'm prefixing things like:

Snippet - Daily Note Link.md
Template - A Commonly Used Template.md
Template - Software.md
Z. Folder Note - Software.md
Z. Include - Default Frontmatter.md

Other possible ideas might be a set of options in the Templater settings which allows users to create new categories of templates, each with their own folder, and each with their own command or dialog prefix. Could be interesting, but seems like more work for everyone. Very flexible though.

acook avatar Oct 13 '23 09:10 acook

I think this would be mostly solved by #1078. Typing s/ should still show Snippets/Daily Note Link with this PR, though the initial dialog would not show just folders, it'd show full paths for everything.

Zachatoo avatar Oct 14 '23 02:10 Zachatoo