Problem with template frontmatter in live preview

I’m using Obsidian 1.7.0 (though this problem happens with 1.6.7 as well) on Mac (problem also happens on Windows) and having a problem with how the front matter in my template is displaying. I’m just using the core templates plugin and not many others aside from periodic notes. My front matter is this:

---
week: {{date:gggg-[W]ww}}
tags:
  - weekly
---

When the template is created it works just fine and shows something like:

---
week: 2024-W27
tags:
  - weekly
---

In source mode obviously it looks fine. In live preview the whole front-matter section shows up as red and it places a red block cursor on the opening bracket of [W]. If I remove the [W] it then displays the front matter as properties as it should but then I don’t get what I want in my weekly note which is a W before the week number.

Question is is this expected behavior or a bug? Not sure when this started happening as I havent edited this template in a long time.

Thanks!

In Source mode, add quotes to your template like so:

---
week: "{{date:gggg-[W]ww}}"
tags:
  - weekly
---

That should take care of it.

Also, when editing templates, it’s best to stick to Source mode.

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