Template Help

What I’m trying to do

Hi! Let’s say I want to create a template for “Person”. Is there a way for me to have a field at the top of the Person template either in the YAML or somewhere else like “Name:” and then when I add the person’s name like “Name: Tom Brady”, everywhere in the note where <%Name%> exists it inserts “Tom Brady”?

This function would have to be contained to just this note, because each “Person” note would be using a different person’s name.

I would like to do this for other types of data too, maybe like “Company:” and then once I fill in that data at the top of the template, everywhere <%Company%> is in the template, it gets replaced with the company data?

1 Like

One approach to asking for information is to use the tp.system.prompt(), store the result, and re-use those results whenever you want to later on. Here is an example asking for the name and the company:

const name = await tp.system.prompt("Name of person: ")
const company = await tp.system.prompt("Name of company: ")
name: <% name %>
company: <% company %>

My dude, <% name %>, is employed in <% company %>

Also see the following for more information on tp.system.prompt() and tp.system.suggester(): tp.system - Templater

1 Like

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