Missing ) error with templater only sometimes. No scripts folder linked

I may forget details so feel free to request I add more…


I’m trying to write a templater function(or script? idk) to write a line of frontmatter in another note. It’s for a projct tracker I’m working on. I want to generate new files based on the frontmatter of a “project setup” file (new file for each milestone delivery for easy notes and linking based on client feedback blah blah). The note creation works, but I can’t get it to write the frontmatter of another note into the frontmatter of the current note. I want to do this so I can call to a variable that’s created based on a universal structure of [“Milestone nameVariableModifier”] where VariableModifier is something like (“Date”, “Notes”, etc) in a span that is generated in a note creation template and I want the date field of the span to be auto populated with the date of my project setup doc due date (I declare all of the duedates ahead of time and I want the final text in the span to read data-date=‘2024-04-04’ or something similar). I thought I found something helpful for adding frontmatter in the templater docs but I can’t find it now. If you’re confused, I give a lot more details later.

What I’m trying to do

Trying to autopopulate a span with the frontmatter of a “generator” note, within which I declare the due date for a group of milestones, and then use a button to trigger templater to create a note for each milestone in a list
(my girlfriend family friendlied all of my test variables for me)

(the list is stored in the frontmatter under an aliass that is generated based on the milestone name [ex: [“Milestone name”]Date] or something. obv the [“”] shit is to get the spaces in there

and it’s like that to make grabbing the aliass easier since I can just put a thing in the template to generate the file name + the modifier),

`VIEW[{frontmatter^Start of project#["<% tp.file.title %>Date"]}]`

^just an example

which is originally written by an inlineList meta bind input and is later formatted to allow spaces, but so far all of that is working so I’ll wait to post more on that part).

Ok, so here’s where I’m at.

I mashed this together from a bunch of other stuff.
Beware of the debug state this is in, that might also be causing an issue but idk.

	var templateDev_content = await app.vault.read(

const frontmatter = templateDev_content.toString().substring(
	templateDev_content.indexOf("---") + 3,

const contentLines = frontmatter.split("\n");


for (const line of contentLines){
	if (line.startsWith(tp.file.title"Date")) {
		console.log("bad line")


And it currently throws this


but if I cut the for loop out and click around the screen enough I can get it to return this:

Which is so close to what I want, but idk why this too sometimes doesn’t work (same error

) only sometimes. Like idk what clicking around the screen is changing for how it’s reading this or how to figure this out. I found a solution that said to fix by removing broken user scripts, which leads me to →

Things I have tried

Reading everything I can find about incorrectly installed TypeScript and how I would fix that (still unsure as it pertains to obsidian templater) and removed all user scripts.

I tried to use some meta bind inline view shit but didn’t get anywhere with that.

	  data-date='\`VIEW[{frontmatter^Start of project#["<% tp.file.title %>Date"]}]\`'
	  data-title="<% tp.file.title %> Due">

I can get it to write correctly, but my template plugin doesn’t wanna read the output as text (idk how to change this even with a [text] or [text(renderMarkdown)] after.

I ended up ditching this in favor of directly writing the date based on the frontmatter ripped from another note.

I can’t seem to get the for loop to work at all and the original one throws an error but only sometimes and sometimes works properly.

One big thing to note is I’m a moron and I also don’t know how to read the console properly so be gentile with me and I’ll post whatever to get this working

Also this was originally concieved in a 3am adderall fueled rage so I may be completely misusing these tools. I also have no background in this shit and don’t know what is happening.

I’m so mad. It’s because I didn’t put a “+” in the for loop.

1 Like

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