From c074c6e3fbda7bf16b3156e8e44169ee9065f4ff Mon Sep 17 00:00:00 2001 From: wang5333 Date: Thu, 2 Jul 2026 17:47:20 +0800 Subject: [PATCH] docs: show how to import page data --- docs/en/guide/data-loading.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/en/guide/data-loading.md b/docs/en/guide/data-loading.md index 1c11e469..c1495f55 100644 --- a/docs/en/guide/data-loading.md +++ b/docs/en/guide/data-loading.md @@ -172,6 +172,21 @@ export default { } ``` +### Importing Page Data Directly + +If you only need data from a few known pages, you can import their generated page data directly instead of creating a content loader: + +```vue + +``` + +This exposes the same `PageData` shape used by [`useData()`](../reference/runtime-api#usedata), including the target page's `frontmatter`, `headers`, `title`, and `description`. For larger collections, prefer `createContentLoader` so VitePress can watch matching files and let you transform or filter the data before it is shipped to the client. + **Types** ```ts