Can I use Buttons plugin to create new notes in the same folder as the note on which the button exists?

What I’m trying to do

I am using Obsidian to keep my notes/minutes from discussions or meetings about the various projects I’m working on. I have a folder for each project, so something like this:

|—Project A
|—Project B
|—Project C

I keep all of my notes for each project in the respective Project directory. I am using the Folder Note plugin so that selecting one of my Project folders displays a note with data for each Project. On this main Project note, I am hoping to have a button (using the Buttons plugin) that will create a new note from an existing template (using Templater) in the respective Project directory.

Things I have tried

I have tried various configurations of Buttons and templates but I can’t find a way to do this. I’ve seen Templater templates that will move a newly created note to a specific directory, but that directory is hard-coded in the template itself.

I would like to somehow pass the current folder to the Templater template as a variable which Templater then evaluates to move the new note to the correct directory.

I don’t want to hard-code any paths in my template if possible because I am regularly getting new projects and would like to keep manual path editing to a minimum.

I’m open to other alternatives to accomplish the same intent, but I’ve been unsuccessful in figuring out any approaches. Thanks for any help.

So I figured out a workable solution. First, I changed the “Default location for new notes” setting to “Same folder as current file” and then I changed my Button to run the Templater command to create a new note from template. Then I just need to click the correct template and the note appears where I needed it.

1 Like

If you’re already having a suggester to choose which template to apply, you could use that choice to indicate the folder also to the tp.file.create_new() call and create the new file in the appropriate folder directly.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.