Since 0.25.0
getPageMarkdown
Build the page Markdown of the item's page.
On this page
Builds the page Markdown of the item's page, the document served to agents in place of it. The item must declare page.
const about = await aboutItem.getPageMarkdown();
Signature
item.getPageMarkdown(): Promise<string>;
Returns
Promise<string>:
- A frontmatter block:
title,descriptionon one line when there is one, andcanonical, the item'spageonsiteUrl, each a quoted string. # {title}, from thetitlefield and falling back to the file name without its extension, then> {description}when thedescriptionfield holds one, then the body without its own frontmatter.- No heading when the body opens with its own H1. The frontmatter block still holds the title and description.
- Site-relative links and images made absolute on
siteUrl, and MDX components replaced throughpage.markdownComponents. - The frontmatter block, the heading and the description only for a JSON item.
Item views can't filter, so it never resolves to null.
Throws
Item "<file>" has no page: declare it to get page Markdown and a Markdown URL.- A raw
ENOENTerror from Node when the file does not exist. - Validation, relation, augment, and component function errors. See Errors.