---
title: "getPageMarkdown"
description: "Build the page Markdown of the item's page."
canonical: "https://www.qino.works/docs/api/item/get-page-markdown"
---

# getPageMarkdown

> Build the page Markdown of the item's page.

Builds the page Markdown of the item's page, the document served to agents in place of it. The item must declare [`page`](https://www.qino.works/docs/api/item#parameters).

```ts title="src/app/md/about/route.ts"
const about = await aboutItem.getPageMarkdown();
```

## Signature

```ts title="@qino/cms"
item.getPageMarkdown(): Promise<string>;
```

## Returns

`Promise<string>`:

- A frontmatter block: `title`, `description` on one line when there is one, and `canonical`, the item's `page` on `siteUrl`, each a quoted string.
- `# {title}`, from the `title` field and falling back to the file name without its extension, then `> {description}` when the `description` field 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 through [`page.markdownComponents`](https://www.qino.works/docs/api/types/page-markdown-component).
- 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 `ENOENT` error from Node when the file does not exist.
- Validation, relation, augment, and component function errors. See [Errors](https://www.qino.works/docs/api/errors).

## See also

- [getMarkdownUrl](https://www.qino.works/docs/api/item/get-markdown-url)
- [negotiateMarkdown](https://www.qino.works/docs/api/negotiate-markdown)
