Obsidian Frontmatter generator: Generate frontmatter from json and javascript

Obsidian frontmatter generator

Generate your frontmatter on save.

:white_check_mark: Powerful, dead simple

Usage

  1. after install the plugin, visit the setting of the plugin

  2. change the frontmatter template

for example, the following frontmatter template

folder: file.folder
title: file.title
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"

Syntax of the frontmatter template

It is just a json. It can access the TFile and do javascript operation

^ even functions work

^ async function doesn’t work

Installation

Install on obsidian plugin marketplace

:hourglass_flowing_sand: Still waiting for review and approval:

Manual Install

  1. cd to .obsidian/plugins

  2. git clone this repo

  3. cd obsidian-frontmatter-generator && bun install && bun run build

  4. there you go :tada:

Note

  1. to stop generate on a file, you can put yaml-gen-ignore: true on the frontmatter. You can also ignore the whole folder in the seting.

  2. the context that you can access is TFile. This can be update in the future. It is extremely flexible.

  3. This plugin also comes with some command to run in folder and in the whole vault.

  4. If you want to contribute, first open an issue.

  5. :rotating_light: This plugin is still under development, don’t try to hack it by using weird keywords or accessing global variables in the template. It should not work but if you figure out a way to hack it, it will just break your own vault.