Creating a tempalter for a new note

Hi I’m trying to make a template with templater for new notes. I want the template to:

  • Ask me for the name of the note.
  • set some frontmatter keys.

But I’m having some problem.

I create the templater folder and inside a script folder. I create a template and a nuevaNota.js
I call the script from the templater.
I allready resolve the name part. But I can resolve the frontmatter problem.
Also the call for the funcion is still there after the new note is create.

<% tp.user.nuevaNota(tp) %>

async function nuevaNota(tp) {
    let title = await tp.system.prompt("Ingresar el nombre de la nota");
    await tp.file.rename(title);
    await tp.frontmatter.title[title]

module.exports = nuevaNota

The result of this is a new note with the name I want but with the js call as test.

Yes, I read something. But everything I read about “asking for the name of the note” refers to templater. In addition to setting the keys with Quickadd, can I make a function that asks me for the name of the note?

Hi @Siiraa
and thanks for pointing this out.

Can I also make QuickAdd create a note in the currently used folder?

This video (by Nicole van der Hoeven, @nvanderhoeven) really helped me to get off the ground with QuickAdd.

Using the Obsidian Quick Add Plugin - YouTube

1 Like

I finally use the tag {{value}} as I allready use it for the filename.

Thaks it was very helpfull. I allready solve it

1 Like

Here’s my simple Templater template for a General Note. Prompts for Note title if the current note is “Untitled” (i.e created from new file, not existing, already named title.

created: "<% tp.file.creation_date("YYYY-MM-DD") %>"
year: <% tp.file.creation_date("YYYY") %>
topic: <% tp.file.cursor(1) %>
aliases: []
//If File is untitled prompt the User to set a Title (Source:
let title = tp.file.title
if (title.startsWith("Untitled")) {
    title = await tp.system.prompt("Title") ?? "Untitled";
    await tp.file.rename(`${title}`);
} %>
Last Modified: `=dateformat(this.file.mtime, "DDDD, HH:mm")`

# <% tp.file.title %> 

<% tp.file.cursor(2) %>

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