Create new file from template #514
Replies: 21 comments 1 reply
-
Hey @Ampa, this has been implemented in 1.1.0. Update and you should have a new hotkey that allows you to create a new note from template. |
Beta Was this translation helpful? Give feedback.
-
@SilentVoid13 this is a great addition, thank you! I hit a bug though, the default hotkey ⌥opt N doesn't work on macOS - it only produces a |
Beta Was this translation helpful? Give feedback.
-
@SilentVoid13 Thanks for adding the new feature. For some reason I am unable to get it to work. Win10, Obsidian 0.11.13 The modal dialog appears, I select a template, and either click with mouse, or hit enter. 😟 |
Beta Was this translation helpful? Give feedback.
-
This sounds like a wonderful feature but I think there's an issue with how it works if you use the tp.file.title in any of your templates. It always gets replaced to Untitled which is the default filename instead of what we name a note. However the tp.file.cursor still works. Perhaps there could be a way to bind the same shortcut to defer replacing certain template items like title in this case? |
Beta Was this translation helpful? Give feedback.
-
Found the problem... New from Template will only work if there is not a file called untitled.md |
Beta Was this translation helpful? Give feedback.
-
Hey @Ampa, thanks for the feedback! This should be fixed in Templater 1.3.0. Templater will also now create new notes in the folder defined in obsidian settings. Can you update and tell me if this works now ? |
Beta Was this translation helpful? Give feedback.
-
Updated, and... looks like you fixed it! Thank you. |
Beta Was this translation helpful? Give feedback.
-
It would be great if something like "New note from template" could be added to Obsidian file explorer’s right-click menu, too. Reason: I often create new notes in subfolders and use the right-click menu on the subfolder to add a new note there. Using Obsidian 0.11.13 on Linux Mint/Cinnamon 20.1, Templater version 1.3.0. |
Beta Was this translation helpful? Give feedback.
-
Hey @Moonbase59, this has been implemented in Templater 1.4.0! |
Beta Was this translation helpful? Give feedback.
-
Hi @SilentVoid13 ,There is a little bug, when I create a new note from template,it will apper the modal dialog, even if there is only one template. |
Beta Was this translation helpful? Give feedback.
-
Works like a charm, thanks for implementing this! |
Beta Was this translation helpful? Give feedback.
-
Is this solved yet? Maybe having a prompt to give it a title before the whole template is inserted would be great. |
Beta Was this translation helpful? Give feedback.
-
Successfully creating new notes from template. However, the new notes keep appearing in my vault root, rather than the same folder as my current file (which is what I have set in my Obsidian settings). |
Beta Was this translation helpful? Give feedback.
-
hi,@SilentVoid13 after I update to the latest 1.6.0 ,the bug appears again... |
Beta Was this translation helpful? Give feedback.
-
I noticed the same behavior with 1.6.0. But if I invoke the new note action from the right-click menu it was created in the folder as expected.
|
Beta Was this translation helpful? Give feedback.
-
I would like to see that as well. Either prompt for a title or even better, fill in the title automatically using a tp command |
Beta Was this translation helpful? Give feedback.
-
Hey @SilentVoid13, do you have any tips how to handle filenames (file.title) in this case? I would like to create a new note from templater and directly generate the filename from the current date plus and input prompt. EDIT: Solved it with JS, took 1 minute, great work with the plugin 👍 <%*
const folder = await tp.system.prompt("Folder")
const title = await tp.system.prompt("Title")
await tp.file.rename(`${title}`)
await tp.file.move(`/${folder}/${title}`)
%>---
title: <%* tR += title %>
creation-date: <% tp.file.creation_date() %>
--- |
Beta Was this translation helpful? Give feedback.
-
I would love to have a separate hotkey/command added to create a new file from a specific template, the same way you can do with inserting a specific template. |
Beta Was this translation helpful? Give feedback.
-
You can already do that by using the built-in template hotkeys: |
Beta Was this translation helpful? Give feedback.
-
That only seems to add a command to insert the template into an existing file, not creating a new file from the template. |
Beta Was this translation helpful? Give feedback.
-
It totally works with my code from above. It asks you for the file name or whatever you define and creates the new file. I use that daily to create daily notes, meeting notes and all kinds of template based workflows. If you want to have a static name or a name based on the current date, etc. you can just edit the following part to match your workflow:
|
Beta Was this translation helpful? Give feedback.
-
At present we can create a new file, and then as a second step insert a template.
Would you consider a new action: Create new from template?
This would carry out both steps as a single action.
Beta Was this translation helpful? Give feedback.
All reactions