Skip to content

getFrontmatterSafe<CustomFrontmatter = unknown>

Retrieves the front matter from the metadata cache safely.

Import:

import { getFrontmatterSafe } from 'obsidian-dev-utils/obsidian/metadata-cache';

Signature:

function getFrontmatterSafe(app: App, pathOrFile: PathOrFile): Promise<CombinedFrontmatter<CustomFrontmatter>>

Parameters:

ParameterTypeDescription
appAppThe Obsidian app instance.
pathOrFilePathOrFileThe path or file to retrieve the front matter from.

Returns: Promise<CombinedFrontmatter<CustomFrontmatter>> — The combined front matter.