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 #
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
The resolved site config that configResolved() received.
Absolute path of the site root, the folder of kawapress.config.ts.
Site title.
Description of pages that set none in frontmatter or locale config.
Deploy path, always starting and ending with /.
Markdown source folder, relative to root.
Glob patterns, relative to srcDir, of Markdown files that are not pages.
The rules that move pages to other routes, if any.
Public folder, relative to srcDir.
Tags added to the <head> of every page.
Theme settings.
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
function listSitePages(site: ResolvedSiteConfig): Promise<SitePage[]>

Comments