Use YAML Front Matter Correctly in Obsidian

Add/use tags, and aliases in YAML.

Image created by Amy Li using Canva.

What Is Metadata?

Screenshot by Amy Li
Screenshot by Amy Li
Screenshot by Amy Li
Screenshot by Amy Li

Create a Valid YAML Front Matter

  • A YAML block needs triple dashes at the start and end to be read by Obsidian (and other apps)
  • It also needs to be placed at the very top of the file.
---
key: value
key2: value2
key3: [one, two, three]
key4:
- four
- five
- six
---
Valid YAML block. (left: editor mode, right: preview mode)
Valid YAML block. (left: editor mode, right: preview mode)

Create Multiple Tags/Aliases

---
type: content, youtube
type: [content, youtube]
type:
- youtube
- content
---
  1. A YAML block needs triple dashes at the start and end to be read by Obsidian (and other apps)
Source: https://help.obsidian.md/Advanced+topics/YAML+front+matter

Use Aliases Correctly in Obsidian

Create Aliases — Add Aliases to Note

---
aliases: this is another name for this file
---
---
aliases: demo aliases, this is a demo for aliases
aliases: [demo aliases, this is a demo for aliases]
---
aliases:
- demo aliases
- this is a demo for aliases
---

Use Aliases

Set aliases in YAML, and use them such as linking to the file or search the file with the aliases. GIF by Amy Li

Use Tags Correctly in Obsidian

Create Tags in YAML

---
tags: content_video
---
---
tags: content_video, content_blog
tags: [content_video, content_blog]
tags:
- content_video
- content_blog
- status_ongoing
- category_productivity
- pkm
- obsidian
---

Use the Tags With Autocompletion Feature

---
tags: [" #content/blog #content/video"]
tags: " #content/blog #content/video"
tags:
- " #content/blog"
- " #content/video"
---
Demo the auto-completion for tags inside YAML block. GIF by Amy Li

The Potential Power of Self-defined Metadata

GIF by Amy Li
Visualize the metadata created by the YAML on the preview mode of Obsidian (Cmd + E). Screenshot by Amy Li
Demo the data query in Dataview which uses the metadata we defined for our notes. GIF by Amy Li

Wrap Up the Two Huge Benefits of Using YAML

Benefit 1: Make the note looks much cleaner

Left: having tags only YAML block. Right: having tags throughout a note. Screenshot by Amy Li

Benefit 2: We could easily define our metadata for our purpose

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store