The template property is breaking when I am using the template

What I’m trying to do

I have made a template with following properties

it gets converted into below type after some time or when I try to use the template. I want id to be of int or number type so that I can run desired query on it.

Things I have tried

Templates files (for the core Template plugin) can only be edited/viewed in Source mode, otherwise, they can break when used :blush:

1 Like

So,Should I always keep template file in source mode before using/importing it in other files.

Well, you shouldn’t need to see the template when it’s applied on/used in a note, I think :thinking:
I mean, the template can normally be applied on a note from Live Preview.

But yes, the template in itself can only (at the moment) be open or edited from Source (at least, if the template contains placeholders meant for YAML/Properties)

1 Like

Yes, sure thing.
I think my initial query is not clear.
Here again, I am using/importing template in new note then I am getting broken front matter. I am not trying to view template files.
Here is a SS to explain this.

Flow: Created Template > Applied on note > Broken Frontmatter

What does the template, the last screenshot, look like in source mode?


If you have unquoted template variables ({{time}}, {{date}}, and {{title}}) in the Properties and you do anything with the metadata editor (Properties in document), the template will be corrupted and won’t work property when applied to a note.

e.g., starting with this template

---
title: {{title}}
created: {{date:YYYYMMDDHHmmss}}
date: {{date:MMM D, YYYY}}
time: {{time:hh:mm:ss A}}
tags:
---

if I use the metadata editor, adding a new property in this case, the template turns into this:

---
title:
  "{ title }":
created:
  "{ date:YYYYMMDDHHmmss }":
date:
  "{ date:MMM D, YYYY }":
time:
  "{ time:hh:mm:ss A }":
tags:
status:
---

which is broken.

source mode | live preview

CleanShot 2026-05-08 at 05.04.52

As Pch said, it’s best to only use Source mode when making or editing templates. You can also quote all of the template variables which lets you use the metadata editor without corruption.

---
title: "{{title}}"
created: "{{date:YYYYMMDDHHmmss}}"
date: "{{date:MMM D, YYYY}}"
time: "{{time:hh:mm:ss A}}"
tags:
---
2 Likes

I think this was the reason. I was unware about it. Thank you.
I don’t want to quote my id property because it will turn it into a string type property.

Understood. So yeah, Source mode for the win, and make a post-it note for yourself to never use the metadata editor with that or similar templates.

Once the template is applied to a note, you can check and set the property type. I wouldn’t try adjusting the type in the template itself.

2 Likes

In addition to the FR that Pch linked, there’s a request to update the help documentation regarding this issue:

(disclaimer, I wrote it :blush:)

2 Likes

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