Create Note apply Templater template - Template Path

I have noticed that Create Note actions were not working when I just entered the template name in the Template Path parameter; the error indicated that the template was not found, but it’s in my Templates folder.

So I thought I might use a Text variable instead, but got the same result.

When I tried either one with the full vault path, then it worked for either scenario (literal or variable).

I think I have used just the template name in previous shortcuts rather than the full path, and they worked. However, it seems something is different now and it must be the template path not just the template name.

When reviewing the Create note documentation for more information, I didn’t see anything except that that parameter is shown as a Template Path with no examples. However, with the note parameter, it can either be a path or name; so I thought the template could also be a path or name.

You might want to add some examples and commentary on the documentation for Create Note, or at least put something in the FAQ about Template Path (like you have for File Path or Name).

Thanks for the report. The template path issue is a regression, I think. A few months back I’ve changed the way Actions URI validates file paths passed as parameters, and this change might’ve been collateral damage. :grimacing:

I’ll probably change the Actions URI-internal handling of template parameters to prepend the template folder set in the Obsidian configuration as a fallback, as in: first check the original parameter, if not valid, prepend the template path, if still not valid, complain.

I have noticed several issues with changes such as vault names, references, etc. Also, there have been some other glitches that seemed odd, but I didn’t manage to capture the behavior. I usually just implemented workarounds.

I know I have a lot of template path parameters spread across many shortcuts, where I probably have used just the template names. So they will all blow up when I run them.

I probably need to define these template paths externally in Data Jar and migrate them over to using the appropriate variable when creating notes with templates. Of course, it’s not easy to go through all my shortcuts to identify where I used Create Note so I can make these changes. Or I can just find them when they cause exceptions and fix them one at a time.

Sounds like you need to review your test cases too so you know when changes introduce regressions.

I know it takes extra effort for both Actions URI and Actions for Obsidian, but it becomes even more important as you add or enhance features as well as address bugs.

Sounds like you need to review your test cases too so you know when changes introduce regressions.

I agree.

FWIW, I’ve pushed out a new Actions URI version, v1.5.1. It makes the template path check more lenient (as should be): If the filename set in “Template Path” parameter can’t be found, the plugin will now check the template folder set in Templates or Templater, respectively, before returning an error.

E.g., if your Templates/Templater template folder is _templates, and the Create action’s “Template Path” parameter is Meeting note, then Actions URI (1.5.1+) will now look for /Meeting Note, /Meeting Note.md, /_templates/Meeting Note, and /_templates/Meeting Note.md, in that order.

1 Like

Thanks for making the Actions URI change.

It’s good that you try to locate the template several ways, but now I’m thinking that it might be better to always specify the folder path and extension since that would bypass the extra API calls.

It might be helpful to explain this behavior in the Create Note or FAQ documentation so we understand the differences of using a template path over just the template name.

I assume that this flexibility applies to many AFO actions, and it sounds like full paths with extension might offer the best performance.

Actually, I do use Data Jar to keep my template paths and names so it makes it simple if I relocate folders in my vault, change names, or use different templates (just like I do for my vault).

I’m finding that useful to keep other common information such as vault name, lists, or dictionaries that are useful across shortcuts for configuration and/or settings.

However, I’m still updating all my shortcuts to use those Data Jar variables. I think this error occurred with an older shortcut, but sometimes I might create a shortcut initially without fetching the Data Jar variables.

Those calls happen entirely in the plugin, i.e. nothing changes in terms of AFO⇄Obsidian communications. One call from AFO, one call back.

I assume that this flexibility applies to many AFO actions, and it sounds like full paths with extension might offer the best performance.

I’ve only implemented it for the templates because in this use case it makes sense, as Templates/Templater ask you to set a folder already. So, AFO looking for templates could be expected, I think.

For note paths, I do prefer the explicitness of having to state the full path – in my mind it reduces the risk of accidentally picking the wrong note (i.e., same name but different folder). But that might be a theoretical problem.

I realize that it’s just one AFO call, but it means that Actions URI would only do 1 local Obsidian API call rather than up to 4. Maybe it’s not much of an issue, but little optimizations add up.

Yes, I guess it would only apply to templated notes and you have access to the template path from Obsidian settings.