File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed
docs/src/content/docs/zh-cn Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -62,20 +62,24 @@ export default defineConfig({
6262
6363### 配置内容集合
6464
65- Starlight 是建立在 Astro 的[ 内容集合] ( https://docs.astro.build/zh-cn/guides/content-collections/ ) 之上的,这些集合在 ` src/content/ config.ts ` 文件中配置。
65+ Starlight 是建立在 Astro 的[ 内容集合] ( https://docs.astro.build/zh-cn/guides/content-collections/ ) 之上的,这些集合在 ` src/content. config.ts ` 文件中配置。
6666
67- 创建或更新内容配置文件,添加一个使用 Starlight 的 ` docsSchema ` 的 ` docs ` 集合:
67+ 创建或更新内容配置文件,添加一个使用 Starlight 的 ` docsLoader ` 和 ` docsSchema ` 的 ` docs ` 集合:
6868
69- ``` js ins={3,6 }
70- // src/content/ config.ts
69+ ``` js ins={3-4,7 }
70+ // src/content. config.ts
7171import { defineCollection } from ' astro:content' ;
72+ import { docsLoader } from ' @astrojs/starlight/loaders' ;
7273import { docsSchema } from ' @astrojs/starlight/schema' ;
7374
7475export const collections = {
75- docs: defineCollection ({ schema: docsSchema () }),
76+ docs: defineCollection ({ loader : docsLoader (), schema: docsSchema () }),
7677};
7778```
7879
80+ Starlight 也支持 [ ` legacy.collections ` 标志] ( https://docs.astro.build/zh-cn/reference/legacy-flags/ ) ,其中集合使用旧版的内容集合实现处理。
81+ 这对于你有一个现有的 Astro 项目,目前无法对集合进行任何更改以使用加载器的情况非常有用。
82+
7983### 添加内容
8084
8185现在 Starlight 已经配置好了,是时候添加一些内容了!
@@ -124,6 +128,6 @@ import { FileTree } from '@astrojs/starlight/components';
124128
125129### 结合 SSR 使用 Starlight
126130
127- 要启用 SSR,请按照 Astro 文档中的 [ “按需渲染适配器”] ( https://docs.astro.build/zh-cn/guides/server-side -rendering/ ) 指南将服务器适配器添加到你的 Starlight 项目中。
131+ 要启用 SSR,请按照 Astro 文档中的 [ “按需渲染适配器”] ( https://docs.astro.build/zh-cn/guides/on-demand -rendering/ ) 指南将服务器适配器添加到你的 Starlight 项目中。
128132
129133无论项目的输出模式如何,Starlight 生成的文档页面都默认为预渲染。要选择不对 Starlight 页面进行预渲染,请将 [ ` prerender ` 配置选项] ( /zh-cn/reference/configuration/#prerender ) 设置为 ` false ` 。
You can’t perform that action at this time.
0 commit comments