Read one file's metadata (MDX frontmatter) by path. Returns undefined when the
path has no metadata. Pass a type parameter for typed field access.
The store is keyed by ABSOLUTE module path — /app/content/post.mdx, the same
identifier fs, module.dynamicImport and <Include> use — not by the
repo-relative path this doc claimed until R3-276. Keeping metadata in the file
space is what lets an app read a file's metadata and render that same file by the
same path (sandbox/src/bundler/metadataKey.test.ts pins it).
A repo-relative path (/content/post.mdx) is accepted as a fallback: if the path
is not a key, it is retried under the app root via the shared
underAppRoot helper (R3-275). That is additive — it only turns a previous
undefined into a value — and it exists because the old doc told people to pass
exactly that form. A path a MetadataSource provided in some other key
space is looked up as given, unchanged.
Read one file's metadata (MDX frontmatter) by path. Returns
undefinedwhen the path has no metadata. Pass a type parameter for typed field access.The store is keyed by ABSOLUTE module path —
/app/content/post.mdx, the same identifierfs,module.dynamicImportand<Include>use — not by the repo-relative path this doc claimed until R3-276. Keeping metadata in the file space is what lets an app read a file's metadata and render that same file by the same path (sandbox/src/bundler/metadataKey.test.tspins it).A repo-relative path (
/content/post.mdx) is accepted as a fallback: if the path is not a key, it is retried under the app root via the sharedunderAppRoothelper (R3-275). That is additive — it only turns a previousundefinedinto a value — and it exists because the old doc told people to pass exactly that form. A path a MetadataSource provided in some other key space is looked up as given, unchanged.