Templater icon indicating copy to clipboard operation
Templater copied to clipboard

Folder Templates don't work on selected Template Folder location

Open dl-lim opened this issue 7 months ago • 3 comments

Plugin information (please complete the following information):

  • OS: Windows 10
  • Templater version: 1.18.1
  • Obsidian version: 1.4.16
  • Templater settings: Template folder location: "Templates/"

Describe the bug If the "Templates/" folder is marked as the template folder location, then Folder Templates for the folder "Templates/" do not work. If I RClick on the "Templates/" folder and select New Note, nothing happens, and a normal Untitled blank note is created.

If I removed the "Templates/" folder from the template folder location, the intended result is achieved.

Expected behavior I have a Template that generates other Templates, and that should work as intended, since I've set the folder template to be used on that folder. Despite having the template folder location set, which is useful for when I want to insert a template elsewhere, it should not stop me from being able to dynamically generate other notes in that specified folder using Templater.

dl-lim avatar Dec 06 '23 17:12 dl-lim

This could cause issues for users that sync templates across devices. Whenever a user creates a new template, when it reaches a new device the template would be executed, and the user would have to undo the execution. There is no way I could stop this, Obsidian sees it as a new file and Templater would execute. I fear adding this feature would do far more harm than good.

There's nothing stopping you from manually inserting "meta" templates in your templates folder.

See relevant conversation here #1100 where for some reason templates are executing in their templates folder, and the frustrations they're facing as a result of that.

TLDR: This is a feature that it works the way it does, and I do not think it is a good idea to remove that feature that is protecting multi-device users.

Zachatoo avatar Dec 07 '23 04:12 Zachatoo

I use multi-device too, and I see what you are saying. The feature is to protect files in the "Templates" folder from executing?

Let's break it down a little further, just to explore options - instead of executing, what about simply including another template without executing any other code? As it would be with a non-dynamic template, for instance? So that the Template folder can have a default template too?

Many thanks for your explanation and support!

dl-lim avatar Dec 18 '23 01:12 dl-lim

That would work!

Going to mark this as an enhancement, since this would be adding new functionality.

Zachatoo avatar Dec 22 '23 20:12 Zachatoo