Migration

Updating old style template variables

If you are using old style template variables <%= VARIABLE =>, you will need to change them to handlebars style which is {{ VARIABLE }}

  • replace all <%= symbols in your templates with {{

  • replace all %> symbols in your templates with }}

  • NOTE: if you are confident that you don't use these symbols anywhere outside of templates, you can do a find/replace across your workspace to replace all occurences at once

Updating frontmatter variables

Frontmatter Variable Substitution lets you substitute values from the frontmatter into your note when viewed in the preview and publishing. There's a problem if you try to use it in a template

Take the following example:

- NOTE: `...` is meant to represent text that is not shown to keep the example short
---
...
color: 
---

Tim ate a {{fm.color}} apple

When used as a template, the resulting note would look like the following:

---
...
color: 
---

Tim ate a apple

When a template is applied, it looks at all {{ }} blocks and tries to resolve them. If you do not want the template to do this, you will need to escape your templates using the followng syntax

---
...
color: 
---

Tim ate a {{{ {{ }}}fm.color{{{ }} }}} apple

If you try to apply this as a template, you now get the expected result

---
...
color: 
---

Tim ate a {{fm.color}} apple


Backlinks