SitePage #

One page of the site, whether it is a Markdown file or a plugin's page.

Fields #

origin'file' | 'plugin'

file for a Markdown file, plugin for a page a plugin added.

fileoptionalstring

Absolute path of the Markdown file. Only file pages have one.

sourcePathstring

Identifier of the source: /guide/intro.md for a file, below srcDir; <plugin name><pagePath>, for example @plugin/intro.md, for a plugin page.

pagePathstring

Path the route comes from, for example /guide/index.md. File pages apply rewrites.

routePathstring

Public route path of the page, for example /guide.

readSource(): Promise<string>

The Markdown the page is compiled from, as it is now: a file page is read from disk with <!--@include--> and <<< written out, a plugin page is the Markdown its plugin gave, with the frontmatter it asked for merged in.

Full type signature
TypeScript
interface SitePage {
  origin: 'file' | 'plugin'
  file?: string
  sourcePath: string
  pagePath: string
  routePath: string
  readSource: () => Promise<string>
}

Edit this page

Comments