From baaf29dc1d7a1164abd5ad4e403efa6a758d7aa4 Mon Sep 17 00:00:00 2001 From: liruifengv Date: Mon, 29 Jan 2024 19:40:33 +0800 Subject: i18n(zh-cn): Update customization.mdx & configuration.mdx (#1430) Co-authored-by: Chris Swithinbank --- docs/src/content/docs/zh-cn/guides/customization.mdx | 19 +++++++++++++++++++ .../content/docs/zh-cn/reference/configuration.mdx | 7 +++++++ 2 files changed, 26 insertions(+) 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({ 默认情况下,每个页面的 `` 都是 `页面标题 | 网站标题`。 举例,本页面的标题是“配置参考”,本站点的标题是“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>` -- cgit