Beginner here: how to I use the following code (stand alone) in yaml,i.e. KEY: "moment().format(" dddd");"?

First, search the help docs and this forum. Maybe your question has been answered! The debugging steps can help, too. Still stuck? Delete this line and proceed.

What I’m trying to do

Things I have tried

Attempting to use the code “moment().format(” dddd");" assigned to the KEY in Yaml at the top of a Template note. I’m sure I’ve taken the code snipe :slight_smile: OUT OF IT’S CONTEXT, but I do need an example how to use it in a Template note (Templater).

In a Templater template you’d put this instead:

<% tp.date.now("dddd") %>
1 Like

For frontmatter/YAML/Properties, I tend to use something like:

<% "---" %>
keyOne: <% tp.date.now("dddd") %> 
keyTwo: <% moment().format("dddd") %> 
<% "---" %>

(where both <% "---" %> are meant to prevent Obsidian from trying to parse the weird looking YAML of the template :sweat_smile: )

… which when applied to an empty note using the command Templater: Open insert template modal and selecting the template containing the snippet above, outputs in Source Mode (at the time of this post) :blush:

---
keyOne: Monday 
keyTwo: Monday 
---
2 Likes

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