resolvePageMetadata #

Reads title, description and titleTemplate from frontmatter. Without a title, the first level-1 heading is the title.

Usage #

TypeScript
import { 
resolvePageMetadata
} from 'kawapress'
const
meta
=
resolvePageMetadata
(
{
description
: 'Hello' },
[{
level
: 1,
title
: 'Intro' }],
)

Parameters

frontmatterRecord<string, unknown>

The frontmatter of the page.

headersreadonly Pick<PageHeader, 'title' | 'level'>[]

The headings of the page.

Returns The title, description and title template of the page.

Full type signature
TypeScript
function resolvePageMetadata(
  frontmatter: Record<string, unknown>,
  headers: readonly Pick<PageHeader, 'title' | 'level'>[],
): PageMetadata

Edit this page

Comments