listSitePages #

Every page of a site: its Markdown files in the order listMarkdownPages() reads them, then the pages plugins add, in plugin order. Two pages on one route are an error that names both sources.

Usage #

TypeScript
import { 
definePlugin
} from 'kawapress'
import {
listSitePages
} from 'kawapress/generator'
export default
definePlugin
({
name
: 'count-pages',
setup
(
api
) {
api
.
configResolved
(async (
site
) => {
const
pages
= await
listSitePages
(
site
)
console
.
log
(
pages
.
length
)
}) }, })

Parameters

siteResolvedSiteConfig

The resolved site config that configResolved() received.

rootstring

Absolute path of the site root, the folder of kawapress.config.ts.

titlestring

Site title.

descriptionoptionalstring

Description of pages that set none in frontmatter or locale config.

basestring

Deploy path, always starting and ending with /.

srcDirstring

Markdown source folder, relative to root.

srcExcludereadonly string[]

Glob patterns, relative to srcDir, of Markdown files that are not pages.

rewritesPageRewrites | undefined

The rules that move pages to other routes, if any.

publicDirstring

Public folder, relative to srcDir.

headreadonly HeadConfig[]

Tags added to the <head> of every page.

themeConfigReadonly<Partial<ThemeConfig>>

Theme settings.

localesReadonly<Record<string, LocaleConfig>>

Every locale; a site without locales has an English root locale.

Returns Every page of the site.

Notes #

site is the object configResolved() received.

Full type signature
TypeScript
function listSitePages(site: ResolvedSiteConfig): Promise<SitePage[]>

Edit this page

Comments