summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorliruifengv2024-01-29 19:40:33 +0800
committerGitHub2024-01-29 12:40:33 +0100
commitbaaf29dc1d7a1164abd5ad4e403efa6a758d7aa4 (patch)
tree6f36ce02c8e12312b07a74905724322cf1758f1f
parent51489f0b5ba3ddbc2b13073012d0e0e3ee495425 (diff)
downloadIT.starlight-baaf29dc1d7a1164abd5ad4e403efa6a758d7aa4.tar.gz
IT.starlight-baaf29dc1d7a1164abd5ad4e403efa6a758d7aa4.tar.bz2
IT.starlight-baaf29dc1d7a1164abd5ad4e403efa6a758d7aa4.zip
i18n(zh-cn): Update customization.mdx & configuration.mdx (#1430)
Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
-rw-r--r--docs/src/content/docs/zh-cn/guides/customization.mdx19
-rw-r--r--docs/src/content/docs/zh-cn/reference/configuration.mdx7
2 files changed, 26 insertions, 0 deletions
diff --git a/docs/src/content/docs/zh-cn/guides/customization.mdx b/docs/src/content/docs/zh-cn/guides/customization.mdx
index c1d533b6..27f164c9 100644
--- a/docs/src/content/docs/zh-cn/guides/customization.mdx
+++ b/docs/src/content/docs/zh-cn/guides/customization.mdx
@@ -271,6 +271,25 @@ hero:
---
```
+### 禁用默认 404 页面
+
+如果你的项目需要完全自定义的 404 布局,你可以创建一个 `src/pages/404.astro` 路由,并设置 [`disable404Route`](/zh-cn/reference/configuration/#disable404route) 配置选项来禁用 Starlight 的默认路由:
+
+```js {9}
+// astro.config.mjs
+import { defineConfig } from 'astro/config';
+import starlight from '@astrojs/starlight';
+
+export default defineConfig({
+ integrations: [
+ starlight({
+ title: '带有自定义 404 页面的文档',
+ disable404Route: true,
+ }),
+ ],
+});
+```
+
## 自定义字体
默认情况下,Starlight 使用用户本地设备上可用的无衬线字体来显示所有文本。这样可以确保文档在加载时以每个用户熟悉的字体快速显示,而不需要额外的带宽下载大型字体文件。
diff --git a/docs/src/content/docs/zh-cn/reference/configuration.mdx b/docs/src/content/docs/zh-cn/reference/configuration.mdx
index d275d8bd..5aa41c5d 100644
--- a/docs/src/content/docs/zh-cn/reference/configuration.mdx
+++ b/docs/src/content/docs/zh-cn/reference/configuration.mdx
@@ -509,6 +509,13 @@ starlight({
默认情况下,每个页面的 `<title>` 都是 `页面标题 | 网站标题`。
举例,本页面的标题是“配置参考”,本站点的标题是“Starlight”,所以本页面的 `<title>` 是“配置参考 | Starlight”。
+### `disable404Route`
+
+**类型:** `boolean`
+**默认值:** `false`
+
+禁用注入 Starlight 的默认 [404 页面](https://docs.astro.build/zh-cn/core-concepts/astro-pages/#自定义-404-错误页面)。要在项目中使用自定义的 `src/pages/404.astro` 路由,请将此选项设置为 `true`。
+
### `components`
**类型:** `Record<string, string>`