Skip to main content

Frontmatter

The frontmatter of a file is the metadata at the beginning of a file. It is usually written in YAML format and is enclosed by ---.

---
title: My Title
tags: [tag1, tag2]
---

Actions on the frontmatter are done using the frontmatterkey parameter.

frontmatterkey parameter structure

Simple Structure

my_item: my_value

To select the field my_value set the parameter frontmatterkey=my_item.

Complex Structure

my_item:
second_item: my_value

To select the field my_value use frontmatterkey=[my_item,second_item]. The value of frontmatterkey is the ordered list of keys to access your value to copy. Each key needs to be separated via ,.

my_item:
second_item:
- A
- B

To select B use frontmatterkey=[my_item,second_item,1], because B is at index 1 in the list.

Read Frontmatter

You can copy values of your frontmatter to the clipboard using a file identifier and the frontmatterkey paramteter.

Complete example:

obsidian://advanced-uri?vault=<vault>&filepath=MyFile&frontmatterkey=[my_item,second_item,1]

Write Frontmatter

You can also write to your frontmatter using the frontmatterkey and data parameter. If the key does not exist, it will be created.

The data parameter is the value you want to write to the frontmatter field. It can be a string, a number, a boolean, a list, or any other JSON object.

Simple Structure

Complete example:

Before:

my_item:
second_item:
- A
- B

After:

my_item:
second_item:
- A
- newValue
obsidian://advanced-uri?vault=<vault>&filepath=MyFile&frontmatterkey=[my_item,second_item,1]&data=NewValue

Complex Structure

Complete example:

Before:

my_item:
second_item:
- A
- B

After:

my_item:
second_item:
- A
- data:
- 2
- 3
obsidian://advanced-uri?vault=<vault>&filepath=MyFile&frontmatterkey=[my_item,second_item,1]&data={%22data%22:[2,3]}