<%tp.file.creation_date("YYYY-MM-DD") %> is your first issue, there are command brackets, therefore the brackets are causing a syntax error
In addition, its considered a part of the string. You need to escape the function first by adding the function to the string instead of placing it inside, for example, const string = "this is" + function + "a string"
Finally, you need to move tp.file.cursor() to the await function instead of including it in the head variable
Thanks for the solution! The thing is that while I wish I knew JS and the Obsidian API to be able to do these things, I haven’t had the time to learn them. I didn’t know about the command brackets thing. I thought the solution would, or at the least could be more complicated than what you did. After trying your edit, I made some changes to use template string syntax and make it cleaner.
I completely understand! Learning new things takes time and focus
Look, don’t beat yourself up about whether your issue was as complex as it felt. You’d be shocked by how often most programmers make simple mistakes!
I’m ngl, I was half asleep when I came up with that and I completely forgot about Templater string syntax. The fact that you took the extra step to simplify my code is admirable, especially for someone who’s barely starting. Majority of people would just take the solution and go
Most errors are syntax errors, my friend. Don’t sweat it. You already have the drive, I believe in you. Let me know if you need any learning resources or help with anything
Look, don’t beat yourself up about whether your issue was as complex as it felt.
it’s interesting you said that, no I don’t feel bad at that! I was just a little surprised the solution was simple since I never took a close at the APIs for Templater and Obsidian. I know other programming languages, just not JS. I thought I could easily pick it up with the cheatsheet on Learn X in Y mins, but there’s a lot of syntax I still don’t understand. When I get time, I’ll look up free courses and tutorials for JS, and then look at the Obsidian API.
I like the anticipation though! Obsidian needs more community contributions