Porting YAML data from one template to another

First, search the help docs and this forum. Maybe your question has been answered! The debugging steps can help, too. Still stuck? Delete this line and proceed.

What I’m trying to do

I take notes on companies (Note Template). Sometimes I’ll take a note on a company I’ve never met before, in which case I want to automatically create a Company Page (Company Template).

My Note Template.md is quite simple:

Entity:: Company1



Into this template, I’ve added code, mostly taken from Trying to create a button that runs a specific templater template - #9 by holroy (thank you holroy !)

const baseFolder = app.vault.getAbstractFileByPath(“Notes”)
const filenameAndFolder = ${tp.date.now("YYYY")}/+
const template = tp.file.find_tfile(“CompanyTemplate”)
await tp.file.create_new(template, filenameAndFolder, false, baseFolder)

This works perfectly in creating a note that is stored in the appropriate folder with the appropriate name.

QUESTION: How can I adjust my code to allow ‘Company1’ to port into the newly created file? Specifically, I’d like to include Company1 into the new file’s (Company Note’s) title [In other words, adjust the const filenameAndFolder line of code].

Things I have tried

I’ve scoured this forum for hours, and have tried numerous ways of including the Entity variable, including ${Entity}, <% Entity %, etc…I’m not a coder so I suspect the fix is relatively easy. Thank you !

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