Skip to content

Caution against using the metadata editor when editing templates with template variables #1027

@trainbuffer

Description

@trainbuffer

Currently using/editing the Properties in document (metadata editor) doesn't play well using unquoted template variables. The example "study notes" template (https://help.obsidian.md/plugins/templates#Create+a+template) has quotes around {{date}}, which is good, but it's not mentioned they are necessary if you use the metadata editor. e.g. Take this template note:

---
title: {{title}}
title_quoted: "{{title}}"
date: {{date}}
date_quoted: "{{date}}"
time: {{time}}
time_quoted: "{{time}}"
tags:
  - testing
---
## {{title}}

If one interacts with the metadata editor in any way (in Live Preview or Reading view), the unquoted variables will become corrupted and unusable with applying the template to a note.

Image

What is your suggestion?

Caution users, maybe in a ⚠️ callout, about creating or editing templates containing variables and using the metadata editor. e.g.

> [!warning] _Template variables_ and the _Properties in document_ view 
> We suggest you switch to [_Source mode_](https://help.obsidian.md/edit-and-read#Source+mode) or change the [_Properties in document_](https://help.obsidian.md/settings#Properties+in+document) setting to `Source` when creating or editing templates containing template variables (`{{date}}`, `{{time}}` and `{{title}}`). Unquoted variables can lead to template corruption.  

Maybe too wordy, but it's a start.

Have any context we can refer to?

Discord, Discord, Discord, Discord, and so on...

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementIndicates new item to be added to the docs.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions