In Obsidian.md, my notes viewer/editor, it is possible to add YAML frontmatter to each note. This is content ignored when a note is displayed and is used to add metadata to a note. The Dataview plugin allows one to query such metadata to display selected lists of such notes. (‘Show me all notes in the folder ‘Books’ where status=read’)

I don’t much like to use YAML, because it can quickly turn into a chore to add them, if you come to depend on them to create overviews and indexes etc.
Dataview also allows me to add datafields inside the actual text of the note. This is already better because whatever else happens, the datafields are within the text of the note itself and can be read there in context. (YAML frontmatter is also inside the note, but separate from the main body of text of the notes, not in context.)

YAML frontmatter is added like this:
---
fieldname:value
fieldname2:anothervalue
---

Adding fields in the main body of the note for Dataview requires using a double colon (::)
Fieldname::value

However when I try to use the latter option, or switch the location of data from the YAML frontmatter to fields included in the main body of a note, the Dataview query returns zero results. I’m not sure why that is, or what I’m doing wrong.

2 reactions on “To YAML Or Not?

  1. The format is coming from Datalog / ClojureScript, which is used by Roam and others.

    I don’t know how to solve your problem other than when I’ve used that format, you need a space after the double colon?

    At the same time, I’ve used YAML Front matter to build essentially text based databases, like a recipe database, with Jekyll.

    I’m running a [tools for thought interchange event](https://talk.fission.codes/t/tools-for-thought-atjson-as-a-potential-format-for-interchange/1880) that seems to have a lot of interest. How do we store advanced things without becoming completely custom?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.