Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions docs/src/content/docs/zh-cn/manual-setup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -62,20 +62,24 @@ export default defineConfig({

### 配置内容集合

Starlight 是建立在 Astro 的[内容集合](https://docs.astro.build/zh-cn/guides/content-collections/)之上的,这些集合在 `src/content/config.ts` 文件中配置。
Starlight 是建立在 Astro 的[内容集合](https://docs.astro.build/zh-cn/guides/content-collections/)之上的,这些集合在 `src/content.config.ts` 文件中配置。

创建或更新内容配置文件,添加一个使用 Starlight 的 `docsSchema` 的 `docs` 集合:
创建或更新内容配置文件,添加一个使用 Starlight 的 `docsLoader` 和 `docsSchema` 的 `docs` 集合:

```js ins={3,6}
// src/content/config.ts
```js ins={3-4,7}
// src/content.config.ts
import { defineCollection } from 'astro:content';
import { docsLoader } from '@astrojs/starlight/loaders';
import { docsSchema } from '@astrojs/starlight/schema';

export const collections = {
docs: defineCollection({ schema: docsSchema() }),
docs: defineCollection({ loader: docsLoader(), schema: docsSchema() }),
};
```

Starlight 也支持 [`legacy.collections` 标志](https://docs.astro.build/zh-cn/reference/legacy-flags/),其中集合使用旧版的内容集合实现处理。
这对于你有一个现有的 Astro 项目,目前无法对集合进行任何更改以使用加载器的情况非常有用。

### 添加内容

现在 Starlight 已经配置好了,是时候添加一些内容了!
Expand Down Expand Up @@ -124,6 +128,6 @@ import { FileTree } from '@astrojs/starlight/components';

### 结合 SSR 使用 Starlight

要启用 SSR,请按照 Astro 文档中的 [“按需渲染适配器”](https://docs.astro.build/zh-cn/guides/server-side-rendering/) 指南将服务器适配器添加到你的 Starlight 项目中。
要启用 SSR,请按照 Astro 文档中的 [“按需渲染适配器”](https://docs.astro.build/zh-cn/guides/on-demand-rendering/) 指南将服务器适配器添加到你的 Starlight 项目中。

无论项目的输出模式如何,Starlight 生成的文档页面都默认为预渲染。要选择不对 Starlight 页面进行预渲染,请将 [`prerender` 配置选项](/zh-cn/reference/configuration/#prerender) 设置为 `false`。
Loading