What I’m trying to do
I am trying to make it so that when I click on the link to a not-yet-created page, I am asked which template to use for that page.
Things I have tried
I found this thread which had this comment from user @Komma that does exactly what I want to do. I have copied my version at the end of this post.
One problem – when I use this there is one line of white space before the frontmatter. I can delete that whitespace by adding
<%_ _%>
before the rest of the code, but then the body of the note says “undefined.” Any suggestions for how to fix (either remove the whitespace or the “undefined” or alternate ways to accomplish this? Thanks!
<%* let filetype = await tp.system.suggester(["daily-template", "people-template", "meeting-template", "reference-template", "weekly-template", "monthly template", "quarterly template", "yearly template"], ["daily-template", "people-template", "meeting-template", "reference-template", "weekly-template", "monthly-template", "quarterly template", "yearly template"]) %>
<%-* if (filetype === "daily-template") { %>
<% tp.file.include("[[daily-template]]") %>
<%-* } else if (filetype === "people-template") { %>
<% tp.file.include("[[people-template]]") %>
<%-* } else if (filetype === "meeting-template") { %>
<% tp.file.include("[[meeting-template]]") %>
<%-* } else if (filetype === "reference-template") { %>
<% tp.file.include("[[reference-template]]") %>
<%-* } else if (filetype === "monthly-template") { %>
<% tp.file.include("[[monthly-template]]") %>
<%-* } else if (filetype === "quarterly-template") { %>
<% tp.file.include("[[quarterly-template]]") %>
<%-* } else if (filetype === "yearly-template") { %>
<% tp.file.include("[[yearly-template]]") %>
<%-* } else { %>
<% tp.file.cursor(1) %>
<%* } -%>```