hananoshikayomaru4k downloadsGenerate frontmatter for your notes from JSON and JavaScript.
Generate your frontmatter on save.
✅ Powerful, dead simple
for example, the following frontmatter template
{
folder: file.parent.path,
title: file.basename,
test: ["1", "2"]
}
will generate this in the file Good recipes/scrambled egg.md on save.
folder: Good recipes
title: scrambled egg
test:
- '1'
- '2'
frontmatter-generator: run file command to the custom save actionsfile.properties?.type === 'kanban'
? {
folder: file.parent.path,
title: file.basename
}
: {}
{
test: (() => {
return { test: 'test' }
})()
}
{
numberOfPages: dv.pages('#ai').length
}
It could be a json or a javascript expression that return an object.
^ even functions work
file, the TFile objectfile.properties will access the yaml object of the current filefile.tags , a string[] which will access the tags of the current file. For example ["#book", "#movie"]dv, the dataview object (you can only access this if you install and enable the dataview plugin)z, the zod objectYou can find it on obsidian plugin marketplace.
.obsidian/pluginscd obsidian-frontmatter-generator && bun install && bun run buildyaml-gen-ignore: true on the frontmatter. You can also ignore the whole folder in the seting.