<%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
However, you’re off to a great start! The best way to learn is seeing an issue and solving it to the best of your ability. Templater Syntax, the Obsidian API, and Javascript aren’t too difficult to grasp
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.
Ohhhh, that’s common sentiment on this forum, so I assumed that’s what you meant by, “I thought the solution would, or at the least could be more complicated”
What other languages do you know? Javascript is pretty easy to get used to if you already know the basics of OOP
Unless you’re planning on making a plugin, you should focus on the Dataview API and Templater API
I don’t see many help posts here so I wouldn’t know the common sentiment in them.
I’m pretty sure I do want to make eventually plugins, maybe even fork and submit PRs for pre-existing ones. There’s functionality I wish Obsidian had and would like to have in my workflow.
You should add Typescript to the To-do list then. Going straight from beginning JavaScript to learning TypeScript is near impossible, you need at least a solid grounding before going into the deep end…
I like the anticipation though! Obsidian needs more community contributions