It was a while after encountering the app before I started using YAML metadata in my Obsidian vault.
Because it seemed intimidating to learn and use, I didn’t feel motivated to learn how it worked, meaning I missed out on all the power of harnessing this feature in Obsidian. Since then I’ve learned, and YAML features in all the notes in my vault.
This article is for those of you who want to learn how to use YAML metadata in Obsidian, but perhaps feel a little intimidated by it. I’m going to go over how it works, some common uses, how I use the feature, and some plugins that make use of the power of YAML metadata.
Let’s get started…
What is YAML metadata?
YAML is a data format used for many things, but the function that this article focuses on, and the function that is found in Obsidian, is to add metadata to markdown files.
This metadata is any additional information or property that you want the file to have or contain.
To add YAML metadata, you place the properties between two sets of three dashes like this, at the beginning of the file:
---
title: Article Title
author: Theo Stowell
date: 14-06-2023
tags: [article, YAML]
---
You write an item on each line, with the value coming after a colon and a space after the property name. Here, the property title
shows that the title of the article is ‘Article Title’. You can add whatever property you like, with whatever value you like, making this a very flexible way of adding metadata to a file.
However, there are some rules you should follow when adding YAML metadata in Obsidian…
Some rules when formatting YAML metadata:
- The key (I call it property) should be all lowercase and can contain spaces or underscores
- The value can be a string, number, boolean, list or dictionary. Strings are a sequence of characters, numbers are numbers(…), a boolean is a true/false value, a list is values in square brackets, separated by commas and a dictionary is a collection of key-value pairs.
- If a value contains spaces or special characters, enclose it in quotes.
By following these rules, you shouldn’t run into too many problems when using YAML metadata in Obsidian.
So you’ve added properties to your notes. It’s now time to do something with them…
Uses of YAML metadata:
In Obsidian, YAML’s often used to classify your notes into different categories, or add information to them. There are plugins that read the YAML and use it to define how the plugin behaves, which I’ll cover later in the article. Some of these functions include:
- Sorting notes into groups based on what’s found in the metadata,
- Displaying notes in tables or other views based on their metadata,
- Customising note appearance — you can define custom CSS in the YAML metadata, and
- Integrating with other tools in your workflow (with the help of Obsidian plugins)
I have many uses for YAML metadata in my vault, including these above. I’ll go over my uses for YAML to provide you with some more specific examples. After this, I’ll share some plugins that either help with adding YAML metadata to your notes, or provide some function based on the values that the metadata of your notes provides.
My uses of YAML metadata:
Project notes — I use the function of folder notes to hold information about projects that I am currently working on. I have folders for each project, based on PARA, allowing me to stay organised and focused. This makes my Obsidian vault a lot more actionable.
I use Dataview to view specific notes contained within the project folder, based on what category I’ve specified them as in their YAML metadata. This also has a use when grouping lecture notes together by topics across modules — I can search all lecture notes and organise by topic by specifying the tag that I want displayed.
I export essays using the Pandoc Plugin — I add markdown citations to the essay, and the plugin needs to know where to access the .bib file that contains the correct bibliography. I also specify date, title, and write the abstract for the piece all within the YAML metadata for my essays.
As I mentioned, I use YAML metadata when organising my university lecture notes. I specify what module the note’s from, add tags depending on what topic is being covered in this lecture, and specify whether I attended the lecture. The plugin Flashcards also connects to these notes and reads the YAML to find what deck to export the cards in that note to.
I have some rather specific uses of YAML metadata in Obsidian, and there are a lot more that I don’t know about. However, I’m going to give you the plugins that I think are most helpful to use when managing YAML metadata in your Obsidian notes…
Best plugins for YAML in Obsidian:
You can split these into two categories — the plugins that help you with organising and adding YAML to your notes and the ones that provide function based on what’s contained in the YAML.
First, I’m going to talk about the former…
Plugins for adding and organising YAML metadata:
- MetaEdit — This is a plugin that allows you to edit the YAML metadata of your note quickly and easily from any point in the note. You can specify values that a specific property can take, so that you’re given a shortlist of selections you can choose from when adding the data.
- Linter — This plugin helps you with applying the formatting rules given above to your YAML metadata. There are lots of settings that are customisable so that when you run the plugin, it rearranges and formats the metadata consistently to the style that you require it to be. You can also customise lots of other settings, so that the content of your notes is neatly formatted too.
- Templater — This is a popular plugin that I’ve talked a lot about recently. It doesn’t specifically cater to YAML metadata, but if you have metadata that you want to repeatedly add to many notes, Templater is the plugin to use. It extends the function of templates in Obsidian, and I’ve labelled it as one of the best plugins for Obsidian power users to take advantage of.
And now, some plugins that make use of the information within YAML metadata:
- Dataview — This is the most popular one. Built almost entirely around being able to query the YAML metadata of the notes in your vault, Dataview is one of the other top plugins for power users. You can use Dataview to write code blocks in your vault to view notes defined by any property or combination of properties given in their YAML metadata. I use this for viewing files related to projects, university modules and resources I access to inform my writing.
- Supercharged Links — A visual plugin — one that’s good for improving the UI of Obsidian. Similar to Dataview, you can specify groups of notes based on the values in their YAML metadata, but this time instead of rendering them inside a table or another type of view, the plugin customises the links to these notes in the vault. You can change their colours, define the emphasis on the link, and pre-pend and append text (or emojis) to the links. This is a visual way to give the links in your vault more context, using the power of YAML metadata.
- Pandoc Plugin — For export of your files. I use this at university for exporting my essays to PDFs, ready to submit. I mentioned earlier that you can insert all the properties of the essay into the YAML metadata — this is what Pandoc reads when rendering the output. It exports to many file formats, which is a useful feature when you have to deliver your work to people in a certain format.
These are some of the plugins that make use of YAML metadata in Obsidian. I recommend that you start out simple when learning to use this feature. Choose one or two different properties that you can add to your notes that will make the most positive impact to your workflow. Most of my notes simply have a category (e.g. books, articles, notes, lectures) and some tags (e.g. productivity, systems, information, minimalism).
I hope that this article has provided you with some value that you can implement into your own PKM workflows, whether in Obsidian or beyond. As always, thank you for reading!