resolvePageMetadata #
从 frontmatter 里读出 title、description 和 titleTemplate。没有 title 时,用第一个一级标题作标题。
用法 #
TypeScript
import { resolvePageMetadata } from 'kawapress'
const meta = resolvePageMetadata(
{ description: 'Hello' },
[{ level: 1, title: 'Intro' }],
)参数
frontmatterRecord<string, unknown>
页面的 frontmatter。
headersreadonly Pick<PageHeader, 'title' | 'level'>[]
页面的各级标题。
返回值 页面的标题、描述和标题模板。
完整类型签名
TypeScript
function resolvePageMetadata(
frontmatter: Record<string, unknown>,
headers: readonly Pick<PageHeader, 'title' | 'level'>[],
): PageMetadata

评论