Change a single property from a template

Change a single property from a template

Published with Share Note 🔸 Part of Obsidian guides

Put this at the end of any Templater template:

<%*
setTimeout(() => {
  app.fileManager.processFrontMatter(tp.config.target_file, frontmatter => {

    // Update or add as many fields as you want
    frontmatter['Some property'] = 'Some value'
    frontmatter['Another property'] = 'Some other value'

    // You can even remove properties if you want
    delete frontmatter['Unwanted property']

  })
}, 200) // the reason for the timeout is to let the template complete first
-%>
Share Note for Obsidian 🌓