Frontmatter Value Types

How Obsidian stores YAML values

FrontMatterCache is typed as { [key: string]: any }1. The actual runtime types depend on YAML parsing:

YAML syntaxJavaScript typeExample
key: hellostring"hello"
key: 42number42
key: 3.14number3.14
key: truebooleantrue (also yes, on)
key: falsebooleanfalse (also no, off)
key: nullnull(also ~ or empty)
key: [a, b]Array["a", "b"]
key:\n - a\n - bArray["a", "b"]
key:\n nested: valObject{ nested: "val" }
key: 2024-01-15DateNative Date object
key: "2024-01-15"string"2024-01-15" (quoted = string)
key: "[[Link]]"string"[[Link]]" (raw string in frontmatter)

Date handling

Unquoted ISO 8601 dates like 2024-01-15 are parsed by YAML as timestamp types, producing native JavaScript Date objects — NOT strings, NOT Moment objects. This is confirmed by Dataview’s parseFrontmatter function2, which explicitly checks value instanceof Date.

Quoted dates like "2024-01-15" remain strings.

Our library normalizes Date objects via toISOString().toLowerCase(). To query for a date, pass a Date object:

cache.getFilesWithFrontmatterValue("created", new Date("2024-01-15"));

Array handling

Arrays are indexed per-element. For tags: [project, todo], both "project" and "todo" are indexed separately under the key "tags".

cache.getFilesWithFrontmatterValue("tags", "project");
// Matches files with tags: [project, ...] or tags: project

[[wikilinks]] inside frontmatter values are stored as raw strings in FrontMatterCache. Separately, they’re extracted into CachedMetadata.frontmatterLinks (since v1.4.0) as FrontmatterLinkCache entries with a key field.

See Links Body vs Frontmatter for how these links are handled in the backlink index.

The position key

Obsidian adds a position key to FrontMatterCache with the document position of the frontmatter block. This library excludes it from indexing.

Footnotes

  1. FrontMatterCache — Obsidian API (obsidian.d.ts:3210) — the interface extends CacheItem and uses [key: string]: any for arbitrary YAML keys.

  2. Dataview markdown-file.ts:338 — parseFrontmatter — checks value instanceof Date to convert YAML timestamps to Luxon DateTime.