How do you put YAML to use in your system?

I’m admittedly new to PKM, Obsidian, all of it, so I apologize for my ignorance!

I have been reading some on using YAML metadata for notes, like a potential future use - UUID for note links in URL scheme

Wanting to see how others are using YAML metadata in their notes.

Could you share an example with:

  1. What type of note is it for you? (meeting note, research, writing, capturing a thought, daily journal, etc.)
  2. What’s your YAML frontmatter look like?
  3. Any plugins or tips to make using YAML/adding it more intuitive?

Thanks for any feedback!

14 Likes

Thanks for this question. I’m interested in the answer too, particularly as there is a significant long-term investment in setting up a YAML system.
I’ve noted that tags in YAML will appear in searches, but any links there will not appear as a backlink in those pages.
So YAML should be for very specific metadata, rather than everything.

6 Likes

Automation

  • I use templates to help create the YAML and metadata. I have a template for different note types.
  • At the start, I used TextExpander (app not plugin). I think it is easier to use templates for these larger version I have. TextExpander is good if you want to have drop down menus to chose from for any category.
  • I use Dataview to short and organize my YAML and inline Dataview content.

Where should metadata go?

My system is still a work in progress. Since the Dataview plugin came out, I’ve been rethinking my process. I’ve been trying to determine what should be in the YAML, a tag, or an inline Dataview pair.

YAML

  • YAML has the nicest formatting of the three. Easy to read and values change color depending on their data type.
  • I can nest inside of a YAML, which I can’t do with inline Dataview.
  • YAML is a more standard format if I decide to go to another system later.
  • Backlinks aren’t seen as links in YAML. So if I don’t want this connection to be in the graph view for some reason, I’d put that metadata in the YAML. One big downside to this is that when I update a link, it will NOT change in the YAML.
  • External links aren’t see in YAML either
  • If the the formatting is wrong, the metadata will tell you that it is invalid.

Inline Dataview

  • Inline metadata is ugly. This is why I am wrapping it in a comment. I can still use Dataview with it, but it won’t show in preview or if I decide to use publish.
  • I can’t nest, but I can use headings.
  • I can add notes if I need to remind myself of what a pair means.
  • Links work as links.
  • I can create checkboxes
  • The double colon is used for other things link the Anki plugin. Haven’t run into issues yet.

Tags

  • The main advantage to me of using tags is data validation. I know I’m typing the correct phrase. Using templates helps too, but having a set format for something makes it easier to find.
  • Tags are also good if I want to see connections in the graph

Example

The YAML is from the template for my daily note. I wanted a bunch of the data in YAML so I could compare weeks, months, and years.

The inline dataview is just a sample of a bunch of categories I use. These aren’t all in my daily note. Every note type has a different template with different YAML and Metadata sections.

YAML

  • Aliases and tags are standard.
  • Overview of the day is just a short recap. Longer items are in the body of the note.
  • AOI is Areas of Intent. I wanted this to be a nested item. Then I could break it down to just AOI.Health.Exercise if I wanted to look at trends. I thought about making the keys under Exercise into an array so I could flatten it in Dataview. However, I doubted I would remember what each index represented. The values in this section varies a lot. There isn’t a need for tags or backlinks. Nesting was the priority. That is why it is in the YAML.

Keywords

This is usually just an array of text and backlinks that highlight what this note should connect to. This is helpful when I haven’t gone through and created links or anything yet.
This could also be where I add links if this note is for a project I’m working on.

Status

My status section is like a to-do list for my notes. Not all statues are used in each note type.
I do have an “NA” version of all statuses. If a certain note doesn’t need to go through that workflow, it is NA. This way I can search for notes that I forgot to use a template or have the wrong metadata version.
For example, literature notes will all have a flash card status, but only a few actually need flash cards. So I use the NA status for all literature notes. Meeting notes never need flash cards. That status isn’t even in that template.
I thought about having just one status for every note, but they all go through different workflows. I needed more of a check list than anything.
It might seem like a lot of work. 1. I plan to work on the items in batches. 2. It is also just to tell me the state of a note. I watch a lot of YouTube videos for tips on things. Like I watched a video on how to do find and replace white space using a shell script. I probably don’t want to go through and link, reference, connect, flash-card, manage-file, or refactor that note unless I’m referencing it in a post or it becomes part of a large project. But at least if I go to that note I’ll know that I haven’t done any of those things.

Tag Format

  • S is for status. I just didn’t want to type it out every time.
  • The next part is what I have to do such as write. The emoji is at the end of the second word so I can start to type the word and it will appear in the list. I never type the last word. I just find it in the list, which is why that can start with an emoji.
  • The third word is kind of a kanban list.
    • NA
    • Complete
    • Backlog
    • Queue
    • Archive
    • Partial
    • Current

Meanings

  • Write - These are for notes like my daily note or scripting notes. These tags are for notes I am creating.
  • Consume - These tags are for literature type notes. I even have a tag for this that is buy. This could be if I start a note for a book or course that I am thinking about purchasing.
  • Link - These tags remind me to go back through my note and make backlinks.
  • Progress - These are true status tags. This is for knowing what notes I should be working on and what ones I can get to later.
  • Reference - These notes tell me to make sure I am adding links to DevonThink, Zotero, and creating citations.
  • Connect - These statues remind me to go back and make connections. This is beyond just creating backlinks. This is more like creating aggregations of information or maps of content.
  • Flash-card - These are for creating flash cards using the Anki plugin.
  • Manage-file - These are for when I just take notes on something but don’t actual put the file in DevonThink. This reminds me to go back an do that.
  • Refactor - I haven’t decided how atomic I want my notes to become. This would let me know if this is a note that I need to refactor or not.

Priority

This lets me know what notes to work on. If a note has a priority of none, then I’m not going to spend time working on any of the status items for it.

Template

My system is changing a lot as new plugins come out, and I learn what my workflow is. The goals is to reach a steady state and spend time working with my system rather than on it. To keep track of what version template this note was made with, I have a backlink to the template.
This will help me if I’m looking for something in Dataview that I added to a new version template that doesn’t exist on older notes. If it is important enough, I could pull up the older version and update them.

Review

To me, the whole point of having notes is to engage with them. Having connections, dataview, and search will surface many notes when I need them. There are some notes I would like to remember that I have. I am setting up a very loose spaced repetition/review system. I’m just creating a dataview table of notes to look at again at intervals (1w, 1m, 3m, 6m, 1y, 2y). I don’t want to memorize what is in the notes. I just want to be aware that they exist. These notes will probably all have an abstract that I pull out in dataview too.

Hope some of that was helpful.

45 Likes

Thanks for taking out the time to write the detailed post! It’s always helpful (and stimulating) to watch other people’s workflows to get ideas. I’ve been waiting for a long time to create some sort of YAML based tracking in my daily notes but I always worry about not being diligent enough to fill everything everyday. Curious about how you enter the values.

Also, of the three places for metadata, I wonder if you know that you can combine the last two. Most of my Dataview inline fields are actually tags since I like the natural language like feel (as opposed to variable-like feeling) for my daily journal. The tags, as you mentioned, also have the benefit of ensuring consistent typing and also, I can then use them in other apps as well where Dataview isn’t a thing. An example of a line in my daily note,

- #Watched:: [[Mad Men]] season 5 with [[John]] in the afternoon and we ordered a pizza.

6 Likes

Hello! Inspiring write up on how you setup your YAML!

Question: How do you query your nested YAML properties with dataview?
When I nest my tags I cannot make them show up in my tables.

2 Likes

take a look at

Currently, I use YAML frontmatter mostly for aliases, and Banner Plugin related stuff.

Aliases are great, because it allows me to reference a note using both a full name, and its acronym; really great for IT notes.

I export markdown as a static html website, so I use YAML for

  • which site is this published on
  • description for html meta data
  • options such as cover image, etc
  • layout to use

Previously I used yaml for title and tags as well, but now I simply extract the first H1 and all words with hashtag for tags. That makes the markdown more readable and user friendly

I can across a way to reference YAML values in the body of a note and I am not able to find the tutorial anymore.

I use custom YAML for dataview and there are some times that I want to have things like Authors in YAML for dataview tables and in the body of a note without having to copy paste this info.

Thanks!

Your reply was so helpful to me. I am very new to Obsidian, and your response explained so much for me. I’m actually excited to get back to my notes now! You should be a teacher.

It must’ve taken a lot of time to explain to us newbies in such detail. Thank you SO much. :heart_decoration:

4 Likes

Hoping more of us show different uses, here’s mine:
Since I’m an academic using Obsidian for my literature notes, I use YAML for the information I could later query via the Dataview plugin. So this is it:

aliases:
- {Here I can use multiple names for the same source}
author: 
source: 
type: book/paper/conference
method: 
tags: [thematic]
quality:
status:

I don’t include other information (like years, or pages) since, as I said, I use YAML mainly to include data that would enable me to find a particular note or notes.

I use a template to create this list in the note.

Greetings!

2 Likes

Not sure if you got this answer already, but you can reference your YAML values in the body of a note using inline dataview query language. The syntax is = this.key where key is the name of the YAML key. Just wrap that in backticks (`) and it should pull the value. You can also pull from YAML on other pages using = [[Page]].key. I’ve even used this with expressions, i.e. to sum values in a note (though I think this is probably not best practice). If it doesn’t display right away, try just clicking elsewhere in the note, then clicking back into the formula and out again, and it should display. Sometimes you have to click out and back in again to force it to update if you are doing something with expressions like summing values.

I hope this helps! Here’s some references.

3 Likes

Saving this!! This is what I’m looking for on my daily checklist!! There is so much to learn with Obsidian!

If you are ok with using a bash script, this might give you some ideas:

#!/bin/bash

# This creates a blank, trackable note in Obsidian in box.

# This is the location of my obsidan vault's inbox folder:
LOCAL="/home/user/Sync/metric/00 System/01 Inbox/"

# This creates a random unique ID for each note in my system:
UUID=`echo $RANDOM | md5sum | cut -c 1-7`

# This value provides a date that is part of the UUID:
ID=`date +%Y%m%d%H%M%S`

# This value is the day's date for the YAML block
DATE=`date -I`

# Prompt user to imput data on the new note:

read -p "Enter note title: " title
read -p "Enter author: " author
read -p "Enter note subject: " subject

# Replace spaces with dashes in typed filename:

Title=`echo $title | sed -e 's/ /-/g'`

# Create file
filename="${Title}.md"
touch "${LOCAL}"${filename}


# Add YAML block to file:

echo "---" >> "${LOCAL}"${filename}
echo "title: $title" >> "${LOCAL}"${filename}
echo "author: $author" >> "${LOCAL}"${filename}
echo "citation:" >> "${LOCAL}"${filename}
echo "date: $DATE" >> "${LOCAL}"${filename}
echo "subject: $subject" >> "${LOCAL}"${filename}
echo "tags: " >> "${LOCAL}"${filename}
#echo "-" >> "${LOCAL}"${filename}
echo "alias:" >> "${LOCAL}"${filename}
echo "uid: $ID-$UUID" >> "${LOCAL}"${filename}
echo "file: " >> "${LOCAL}"${filename}
echo "---" >> "${LOCAL}"${filename}
echo "" >> "${LOCAL}"${filename}