Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i18n(zh-cn): Update basics/astro-pages.mdx #8577

Merged
merged 3 commits into from
Jun 20, 2024
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: 14 additions & 2 deletions src/content/docs/zh-cn/basics/astro-pages.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Astro 使用一种名为 **基于文件的路由** 的路由策略。`src/pages/

一个文件也可以使用[动态路由](/zh-cn/guides/routing/#动态路由)来生成多个页面。这允许你即使内容不在特殊的 `/pages/` 目录中,也可以创建页面,例如在[内容集合](/zh-cn/guides/content-collections/)或[内容管理系统](/zh-cn/guides/cms/)中。

<ReadMore>了解更多关于 [Astro 路由](/zh-cn/guides/routing/)的内容。</ReadMore>
<ReadMore>了解更多关于 [Astro 路由](/zh-cn/guides/routing/) 的内容。</ReadMore>

### 页面之间的链接

Expand Down Expand Up @@ -95,10 +95,22 @@ title: '我的 Markdown 页面'

## 自定义 404 错误页面

想要自定义 404 错误页面,你可以在 `/src/pages` 中创建 `404.astro` 或 `404.md` 文件。
想要自定义 404 错误页面,你可以在 `src/pages` 中创建 `404.astro` 或 `404.md` 文件。

它将生成 `404.html` 页面。大多数[部署服务](/zh-cn/guides/deploy/)都自动找到并使用它。

## 自定义 500 错误页面


要为[按需渲染的页面](/zh-cn/guides/server-side-rendering/#启用按需服务器渲染)创建自定义的 500 错误页面,可以创建一个 `src/pages/500.astro` 文件。但这个自定义页面不适用于预渲染的页面,也不能被预渲染。

如果在渲染此页面时发生错误,将显示主机默认的 500 错误页面给访问者。

<p><Since v="4.10.3" /></p>

在开发过程中,如果你有一个 `500.astro` 文件,运行时抛出的错误将被记录在终端中,而不是显示在错误覆盖层中。


## 局部页面

<p><Since v="3.4.0" /></p>
Expand Down
Loading