Search...Search plugins and themes...
⌘K
Sign in
  • Get started
  • Download
  • Pricing
  • Enterprise
  • Account
  • Obsidian
  • Overview
  • Sync
  • Publish
  • Canvas
  • Mobile
  • Web Clipper
  • CLI
  • Learn
  • Help
  • Developers
  • Changelog
  • About
  • Roadmap
  • Blog
  • Resources
  • System status
  • License overview
  • Terms of service
  • Privacy policy
  • Security
  • Community
  • Plugins
  • Join the community
  • Discord
  • Forum / 中文论坛
  • Merch store
  • Brand guidelines
Follow us
DiscordTwitterBlueskyThreadsMastodonYouTubeGitHub
© 2026 Obsidian

Frontmatter generator

hananoshikayomaruhananoshikayomaru4k downloads

Generate frontmatter for your notes from JSON and JavaScript.

Add to Obsidian
  • Overview
  • Scorecard
  • Updates20

Generate your frontmatter on save.

✅ 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.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'
  1. install obsidian-custom-save and add the frontmatter-generator: run file command to the custom save actions
  • Basic Demo: https://youtu.be/Cz9d5e1WQVM
  • Tag properties demo: https://www.youtube.com/watch?v=lyhrOG2Sn88&t=16

Advanced usage

conditional expression

file.properties?.type === 'kanban'
 ? {
   folder: file.parent.path,
   title: file.basename
   }
 : {}

function

{
 test: (() => {
  return { test: 'test' }
 })()
}

Dataview

{
 numberOfPages: dv.pages('#ai').length
}

Syntax of the frontmatter template

It could be a json or a javascript expression that return an object.

^ even functions work

Variable that it can access

  • file, the TFile object
  • file.properties will access the yaml object of the current file
  • file.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 object

Installation

Install on obsidian plugin marketplace

You can find it on obsidian plugin marketplace.

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 🎉

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. 🚨 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.
53%
HealthFair
ReviewRisks
About
Generate frontmatter on save from JSON or JavaScript templates and insert YAML into files automatically. Use templates (including functions and Dataview expressions) that reference file, file.properties, file.tags, dv, and z; run per file, folder, or vault and skip files with yaml-gen-ignore.
TemplatingPropertiesAutomation
Details
Current version
1.0.24
Last updated
2 years ago
Created
3 years ago
Updates
20 releases
Downloads
4k
Compatible with
Obsidian 0.15.0+
License
MIT
Report bugRequest featureReport plugin
Sponsor
Buy Me a Coffee
GitHub Sponsors
Author
hananoshikayomaruhananoshikayomaru
yomaru.dev
GitHubhananoshikayomaru
  1. Community
  2. Plugins
  3. Templating
  4. Frontmatter generator

Related plugins

Templater

Create and use dynamic templates.

QuickAdd

Quickly add new notes or content to your vault.

MetaEdit

Manage your metadata.

PodNotes

Write notes on podcasts with ease.

Update frontmatter modified date

Automatically update a frontmatter modified date field when the file is modified.

Fold Properties By Default

Always have editor/metadata properties folded by default

Modal forms

Define forms for capturing data that you will be able to open from anywhere you can run JavaScript.

BRAT

Easily install a beta version of a plugin for testing.

Meta Bind

Make your notes interactive with inline input fields, metadata displays, and buttons.

Linter

Format and style your notes. Linter can be used to format YAML tags, aliases, arrays, and metadata; footnotes; headings; spacing; math blocks; regular Markdown contents like list, italics, and bold styles; and more with the use of custom rule options.