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 `---`.
```yaml
---
title: My Title
tags: [tag1, tag2]
---
```
Actions on the frontmatter are done using the `frontmatterkey` parameter.
## `frontmatterkey` parameter structure
### Simple Structure
```yaml
my_item: my_value
```
To select the field `my_value` set the parameter `frontmatterkey=my_item`.
### Complex Structure
```yaml
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 `,`.
```yaml
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](File%20identifiers.md) and the `frontmatterkey` paramteter.
**Complete example:**
```
obsidian://adv-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. Use `null` for an empty value.
> [!NOTE]
> For both read and write the associated file is opened by default. To prevent it from opening or control the behavior, use the `openmode` parameter. See [[Navigation Parameters]] for more information.
## Focus Property
To focus the cursor on a specific property in the frontmatter, use the values `append`, `prepend`, or `overwrite` for the `mode` parameter.
E.g. to focus on the property `my_item` in the frontmatter, use the following URI:
```
obsidian://adv-uri?vault=<vault>&filepath=MyFile&frontmatterkey=my&mode=append
```
### Simple Structure
**Complete example:**
Before:
```yaml
my_item:
second_item:
- A
- B
```
After:
```yaml
my_item:
second_item:
- A
- newValue
```
```
obsidian://adv-uri?vault=<vault>&filepath=MyFile&frontmatterkey=[my_item,second_item,1]&data=NewValue
```
### Complex Structure
**Complete example:**
Before:
```yaml
my_item:
second_item:
- A
- B
```
After:
```yaml
my_item:
second_item:
- A
- data:
- 2
- 3
```
```
obsidian://adv-uri?vault=<vault>&filepath=MyFile&frontmatterkey=[my_item,second_item,1]&data={%22data%22:[2,3]}
```
### Prepend/Append To List
When using number as index of a list in frontmatter, you could:
- Use any number less than `0` (E.g. `-1`) to prepend data to that list.
- Use any number greater than the maximum index to append data to that list.
Check the example below:
```yaml
my_item:
second_item:
- A
- data:
- 2
- 3
```
```
obsidian://adv-uri?vault=<vault>&filepath=MyFile&frontmatterkey=[my_item,second_item,-1]&data=prepended_data
```
```
obsidian://adv-uri?vault=<vault>&filepath=MyFile&frontmatterkey=[my_item,second_item,3]&data=appended_data
```
The frontmatter will be updated to the following after this operation:
```yaml
my_item:
second_item:
- prepend_data
- A
- data:
- 1
- 2
- 3
- appended_data
```