Get AI summaries of any video or article — Sign up free
YAML in Obsidian - A Prerequisite For Dataview thumbnail

YAML in Obsidian - A Prerequisite For Dataview

FromSergio·
4 min read

Based on FromSergio's video on YouTube. If you like this content, support the original creators by watching, liking and subscribing to their content.

TL;DR

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?

Dataview’s built-in metadata is useful, but it limits queries to fields Obsidian provides automatically (like created date, file size, title, and path). YAML adds user-defined metadata fields, letting Dataview filter and sort notes using parameters that match a person’s workflow—such as star ratings, genres, or custom classification keys.

What is the exact structure of a valid YAML header in Obsidian?

A YAML front matter block must be placed at the very top of the note and wrapped with three dashes, then another three dashes. The content between them is written as key-value pairs (for example, tags: evergreen notes, alias: our yaml presentation, type: youtube). Obsidian recognizes the header when the format is correct and preview mode confirms validity.

What common formatting mistakes make YAML invalid in Obsidian?

Two major pitfalls are (1) placing any text above the YAML block—typing even a single character before the front matter makes it invalid, and (2) incorrect spacing after colons. Removing the space after a colon (e.g., tags:evergreen notes) triggers an “invalid YAML” warning in preview mode.

How should multiple tags or aliases be written in YAML for Obsidian?

Multiple values must be separated with commas. For example, if type has multiple entries, the second value requires a comma before it. The transcript also mentions an alternative list style using indentation: each item can be placed on its own line, but each line needs proper leading spaces to keep the YAML valid.

Why do some YAML fields appear under Obsidian’s metadata panel while others don’t?

Obsidian natively supports certain metadata fields—specifically tags, aliases, CSS class, and publish—so those show up under the metadata area. Other YAML keys (like type) remain visible in the YAML header but don’t automatically populate the metadata panel.

Review Questions

  1. What two rules make YAML front matter fail in Obsidian, and how does preview mode help catch them?
  2. How do you format multiple values for a YAML key like tags or aliases in Obsidian?
  3. 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. 1

    Dataview’s automatic metadata is helpful, but YAML enables custom fields so queries can match a user’s own organization system.

  2. 2

    YAML front matter must be enabled in Obsidian by turning on “show front matter” in editor settings.

  3. 3

    A valid YAML block uses triple-dash delimiters and must be the very first content in the note.

  4. 4

    YAML is strict about spacing—there must be a space after colons, or preview mode will flag “invalid YAML.”

  5. 5

    Multiple tags/aliases are written using commas, or as an indented list with correct leading spaces.

  6. 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. 7

    Using YAML improves note cleanliness, provides immediate error feedback, and makes Dataview queries far more flexible.

Highlights

YAML front matter must be the first thing in a note—typing even a single character above it breaks recognition.
Preview mode functions like a validator: missing the space after a colon or breaking the front matter format produces “invalid YAML.”
Obsidian only natively displays certain YAML-derived fields (tags, aliases, CSS class, publish) in the metadata panel; custom keys like type remain in the YAML header.

Topics