What I’m trying to do
Hello! I would like to have different categories of links (e.g. for literature, primary sources, my ideas, etc.). This would allow me to then assign a specific color to each category, and have a much tidier and visually clear document!
Things I have tried
I am trying to use Templater to do this. I created a Template with this code:
<%*
const category = tp.prompt(“Enter the category (lit, ps, case, top, idea):”);
const title = tp.prompt(“Enter the note title:”);
const prefix = category === “lit” ? “lit_” :
category === “ps” ? “ps_” :
category === “case” ? “case_” :
category === “top” ? “top_” :
category === “idea” ? “idea_” : “”;
const formattedLink = [[${prefix}${title}|${title}]]
;
%>
<%= formattedLink %>
However, if I try to invoke this template, I receive the following error notification: “Templater error: template parsing error. Aborting. Check console for more information.” This actually happens even time I try to invoke a template with Templater - even a much simpler one.
What am I missing?? I am thinking this may have to do with my Templater settings, or the way I use it. I am very new to this.
To invoke a template I do the following:
cmd + P, select “Templater: Open insert template modal”, and then select the note that contains the code (the note is located in the Templates folder where Templater goes to look).
In terms of settings, ChatGPT tells me I need to toggle on an option to “Enable JavaScript in templates”, but I don’t have that option. All I have is a “Scripts files folder location”, but that is for JavaScript files, not markdown files, which is what my code is. Should I put my code in a Java script instead and place it in the root folder?
Thanks for any help !