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’m trying to use templater to insert a backlink into a notes frontmatter:
const proj = await tp.system.prompt(“Please enter a project ID”)
project: [[<% proj %>]] OR
project: <% “[[” + proj + “]]” %>
The result is always:
project: [[“RSCM”]] instead of [[RSCM]]
How can I do this?
Things I have tried
Are you putting quotes around
RSCM when you type it in the prompt? When I test the latter method, I always get
However, if you’re putting a backlink in the frontmatter, you want to put quotes around the brackets. Your code should look like this:
const proj = await tp.system.prompt("Please enter a project ID")
project: <% "\"[[" + proj + "]]\"" %>
That way, when you type
RSCM into the prompt, you will get back:
This will set up a proper link to the RSCM note in the frontmatter of your current note.