Hello everyone, I’m new to Obsidian and I’m trying to set up my vault to help me manage my projects in my work. I wanted to use the “templater” plugin but I systematically encounter errors and most often this error:
<%*
let testVar = “Bonjour”;
e.g. tp.file.echo(testVar + " du script !");
e.g. tp.file.echo("Propriete du frontmatter : " + tp.file.frontmatter.test_prop);
%>
oh yeah. You’ll want to use this instead: tR += testVar + " du script !"
When you’re inside the js execution templater commands (ie, within <%* %> you need to use tR to add page content.
If you just want to see if it’s working in a console printout, you need to use console.log() instead.
Oh thank you for the links. In fact i just want to make template and put a date for the start of the project and after, Depending on the projects I need to complete and the deadlines I have to meet, I can set dates 3 days ahead, 5 days ahead, or 30 days ahead of the start date. Here’s what an AI suggests after numerous unsuccessful attempts:
“Today’s date: <% tp.date.now(“YYYY-MM-DD”) %>
Date +3 days: <% tp.date.now(“YYYY-MM-DD”, “3d”) %>”
With this code, I have today’s date on both lines, whereas on the second line, I should have the date +3 days, right?
And now i have a différent problem. I would like to be able to indicate a start date in my header and then in the body of the page the tasks are updated with a due date based on the start date. Here is a code that was suggested to me but in return I have “invalid date”. Do you know why?
I finally found my mistake!!
Actually, I was using the keyboard shortcut “ALT+E” instead of manually selecting the template from “CTRL+P”… Yet the shortcut to insert a template was clearly displayed as “ALT+E”… But hey… the most important thing is that it works!