resolveDocumentTitle #

Works out the text of <title> for a page: its titleTemplate applied to the page title, or Page title | Site title.

Usage #

TypeScript
import { 
resolveDocumentTitle
} from 'kawapress'
const
title
=
resolveDocumentTitle
({
title
: 'Intro' }, 'Docs')

Parameters

metadataPageMetadata

The title, description and title template of the page.

titlestring

Page title. Empty when the page has none.

descriptionoptionalstring

Page description.

titleTemplateoptionalstring | false

Template for <title>, where %s is the page title; false shows the page title alone.

siteTitlestring

The site title.

Returns The text for <title>.

Full type signature
TypeScript
function resolveDocumentTitle(metadata: PageMetadata, siteTitle: string): string

Edit this page

Comments