Skip to content

How to add a property with Templater? #1450

Answered by Zachatoo
igorteuri asked this question in Help
Discussion options

You must be logged in to vote

There's not a Templater function for that, but you can use Obsidian APIs. Here's an example from the documentation.

<%*
tp.hooks.on_all_templates_executed(async () => {
  const file = tp.file.find_tfile(tp.file.path(true));
  await app.fileManager.processFrontMatter(file, (frontmatter) => {
    frontmatter["key"] = "value";
  });
});
-%>

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@igorteuri
Comment options

Answer selected by igorteuri
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants