YAML in Obsidian - A Prerequisite For Dataview
Based on FromSergio's video on YouTube. If you like this content, support the original creators by watching, liking and subscribing to their content.
Dataview’s automatic metadata is helpful, but YAML enables custom fields so queries can match a user’s own organization system.
Briefing
Obsidian’s Dataview plugin becomes far more powerful once notes are annotated with custom metadata—and YAML is the key mechanism that makes those annotations both readable and queryable. Dataview automatically generates many metadata fields (like file creation date, file size, title, and path), but relying only on built-in metadata limits what can be searched and filtered. YAML lets users attach their own structured metadata to individual notes, so Dataview can query using parameters the user chooses rather than only what Obsidian provides by default.
The transcript frames metadata as “data about data,” explaining that digital files already carry system-generated metadata (such as resolution, file type, and geolocation when available). In Obsidian, Dataview similarly creates automatic metadata for each note, but users can also add their own—like a star rating, genre, or tags—directly inside the note. That custom layer is what unlocks Dataview’s flexibility. YAML is presented as a human-friendly way to embed that metadata, comparable in purpose to JSON or XML but easier to write and interpret.
A practical walkthrough follows, starting with an Obsidian setting: enabling “show front matter” in the editor settings. YAML metadata in Obsidian is added as a “front matter” block at the very top of the note, delimited by three dashes, then another three dashes. Inside that block, key-value pairs define metadata fields. Examples include tags: evergreen notes, alias: our yaml presentation, and type: youtube. When the YAML header is valid, Obsidian recognizes fields like aliases—so searching for “our yaml presentation” surfaces the note—and preview mode confirms that the structure is being interpreted correctly.
The transcript emphasizes YAML’s strictness, which is also its benefit. YAML must be the first content in the note; even a single character typed above the YAML block breaks recognition. Spacing matters: removing the space after a colon (for example, writing “tags:evergreen notes” instead of “tags: evergreen notes”) triggers an “invalid” YAML warning in preview mode. For list-like fields such as multiple tags or multiple aliases, items must be separated with commas. The speaker also notes an alternative formatting approach: using indentation to represent a list, where each item is preceded by a space to maintain valid YAML structure.
Finally, the transcript clarifies why some fields appear under Obsidian’s “metadata” area while others don’t. Obsidian natively surfaces certain metadata types—specifically tags, aliases, CSS class, and publish—so those show up in the metadata panel, while other YAML keys (like type) remain in the YAML header display. The payoff is threefold: YAML flags mistakes immediately via “invalid YAML,” keeps notes cleaner than scattered annotations, and enables Dataview queries based on user-defined parameters. The next step—Dataview usage—is positioned as the natural follow-up once YAML annotations are in place.
Cornell Notes
YAML front matter is the structured way to attach custom metadata to Obsidian notes so Dataview can query them using user-defined fields. Dataview already auto-creates metadata like file creation date, size, title, and path, but YAML lets users add their own parameters (e.g., tags, aliases, and custom keys like type). YAML must be enabled in Obsidian via “show front matter,” and the YAML block must be the very first content in the note, wrapped in triple-dash delimiters. Preview mode acts as a validator: missing required spacing after colons or breaking the front matter position produces “invalid YAML.” Correct formatting for multiple values uses commas or an indented list style.
Why does custom metadata matter if Dataview already generates metadata automatically?
What is the exact structure of a valid YAML header in Obsidian?
What common formatting mistakes make YAML invalid in Obsidian?
How should multiple tags or aliases be written in YAML for Obsidian?
Why do some YAML fields appear under Obsidian’s metadata panel while others don’t?
Review Questions
- What two rules make YAML front matter fail in Obsidian, and how does preview mode help catch them?
- How do you format multiple values for a YAML key like tags or aliases in Obsidian?
- Which YAML keys are natively surfaced in Obsidian’s metadata panel, and which example key in the transcript does not appear there?
Key Points
- 1
Dataview’s automatic metadata is helpful, but YAML enables custom fields so queries can match a user’s own organization system.
- 2
YAML front matter must be enabled in Obsidian by turning on “show front matter” in editor settings.
- 3
A valid YAML block uses triple-dash delimiters and must be the very first content in the note.
- 4
YAML is strict about spacing—there must be a space after colons, or preview mode will flag “invalid YAML.”
- 5
Multiple tags/aliases are written using commas, or as an indented list with correct leading spaces.
- 6
Obsidian natively surfaces tags, aliases, CSS class, and publish in the metadata panel; other YAML keys (like type) stay in the YAML header view.
- 7
Using YAML improves note cleanliness, provides immediate error feedback, and makes Dataview queries far more flexible.