diff --git a/src/content/docs/fr/reference/configuration-reference.mdx b/src/content/docs/fr/reference/configuration-reference.mdx index af9639f5614b5..79c06116cf7da 100644 --- a/src/content/docs/fr/reference/configuration-reference.mdx +++ b/src/content/docs/fr/reference/configuration-reference.mdx @@ -1700,7 +1700,7 @@ const countries = defineCollection({ export const collections = { countries }; ``` -Pour une logique de chargement plus avancée, vous pouvez définir un chargeur d'objets. Cela permet des mises à jour incrémentielles et un chargement conditionnel tout en offrant un accès complet au magasin de données. Consultez l'API dans [la RFC de l'API Content Layer](https://github.com/withastro/roadmap/blob/content-layer/proposals/0047-content-layer.md#loaders). +Pour une logique de chargement plus avancée, vous pouvez définir un chargeur d'objets. Cela permet des mises à jour incrémentielles et un chargement conditionnel tout en offrant un accès complet au magasin de données. Consultez l'API dans [la RFC de l'API Content Layer](https://github.com/withastro/roadmap/blob/content-layer/proposals/0050-content-layer.md#loaders). #### Migration d'une collection de contenu existante pour utiliser l'API Content Layer @@ -1765,4 +1765,4 @@ Vous pouvez convertir une collection de contenu existante avec des entrées Mark #### En savoir plus -Pour retrouver une présentation complète et la référence détaillée de l'API, consultez [le RFC de l'API de la couche de contenu](https://github.com/withastro/roadmap/blob/content-layer/proposals/0047-content-layer.md) et [partagez vos commentaires](https://github.com/withastro/roadmap/pull/982). +Pour retrouver une présentation complète et la référence détaillée de l'API, consultez [le RFC de l'API de la couche de contenu](https://github.com/withastro/roadmap/blob/content-layer/proposals/0050-content-layer.md) et [partagez vos commentaires](https://github.com/withastro/roadmap/pull/982). diff --git a/src/content/docs/zh-cn/reference/configuration-reference.mdx b/src/content/docs/zh-cn/reference/configuration-reference.mdx index fbfc96ad8b2e5..806c8664d44e7 100644 --- a/src/content/docs/zh-cn/reference/configuration-reference.mdx +++ b/src/content/docs/zh-cn/reference/configuration-reference.mdx @@ -43,7 +43,9 @@ export default defineConfig({ **类型**:`string`

-你要部署到的基本路径。Astro 在开发过程中会匹配这个路径名,这样你的开发环境就会尽可能地与你的构建环境匹配。在下面的例子中,`astro dev` 会在 `/docs` 处启动你的服务器。 +你要部署到的基本路径。Astro 在开发过程中会匹配这个路径名,这样你的开发环境就会尽可能地与你的构建环境匹配。 + +在下面的例子中,`astro dev` 会在 `/docs` 处启动你的服务器。 ```js { @@ -160,8 +162,8 @@ export default defineConfig({ 指定构建的输出目标。 -- `static`- 构建静态网站,部署到任何静态托管服务器上; -- `server` - 构建应用,部署到支持 SSR(服务器端渲染)的托管服务器上; +- `static`- 构建静态网站,部署到任何静态托管服务器上。 +- `server` - 构建应用,部署到支持 SSR(服务器端渲染)的托管服务器上。 - `hybrid` - 构建包含少量服务端渲染页面的静态网站。 ```js @@ -185,7 +187,7 @@ export default defineConfig({ 使用构建适配器将其部署到你最喜爱的服务器、无服务器或边缘主机。导入我们的第一方适配器 [Netlify](/zh-cn/guides/deploy/netlify/#ssr-适配器)、[Vercel](/zh-cn/guides/deploy/vercel/#ssr-适配器),以及更多的适配器来使用 Astro SSR。 -[有关 SSR 的更多信息,请参见我们的服务器端渲染指南](/zh-cn/guides/server-side-rendering/),以及[我们的部署指南](/zh-cn/guides/deploy/)以获得完整的主机列表。 +有关 SSR 的更多信息,[请参见我们的服务器端渲染指南](/zh-cn/guides/server-side-rendering/),以及[我们的部署指南](/zh-cn/guides/deploy/)以获得完整的主机列表。 ```js import netlify from '@astrojs/netlify'; @@ -604,9 +606,7 @@ export default defineConfig({

-指定是否在构建期间将重定向输出到 HTML 中。 - -此选项仅适用于 `output: 'static'` 模式;在 SSR 中,重定向会被作为和其他响应一样对待。 +指定是否在构建期间将重定向输出到 HTML 中。此选项仅适用于 `output: 'static'` 模式;在 SSR 中,重定向会被作为和其他响应一样对待。 此选项主要适用于具有用于重定向的特殊配置文件且不需要(或不希望)基于 HTML 的重定向的适配器。 @@ -901,10 +901,10 @@ prefetch: { `remotePatterns` 可以通过以下四个属性进行配置: -1. `protocol` -2. `hostname` -3. `port` -4. `pathname` +1. protocol +2. hostname +3. port +4. pathname ```js { @@ -1361,64 +1361,8 @@ Astro 提供了实验性标志,以便用户提前使用新功能。这些标 - `/blog/post/0` 由文件基础路由 `/blog/post/[pid]` 构建(而不是注入路由 `/blog/[...slug]`) - `/posts` 由重定向到 `/blog` 构建(而不是文件基础路由 `/[page]`) - 在路由冲突的情况下,两个具有相同路由优先级的路由试图构建相同的 URL,Astro 将记录警告,标识出冲突的路由。 -### experimental.rewriting - -

- -**类型:** `boolean`
-**默认值:** `false`
- -

- -启用一个路由功能,用于在 Astro 页面、端点和 Astro 中间件中重写请求,使你可以对路由进行编程控制。 - -```js -{ - experimental: { - rewriting: true, - }, -} -``` - -在你的 `.astro` 文件中使用 `Astro.rewrite` 来重定向到不同的页面: - -```astro "rewrite" ---- -// src/pages/dashboard.astro -if (!Astro.props.allowed) { - return Astro.rewrite("/") -} ---- -``` - -在你的端点文件中使用 `context.rewrite` 来重定向到不同的页面: - -```js -// src/pages/api.js -export function GET(ctx) { - if (!ctx.locals.allowed) { - return ctx.rewrite("/") - } -} -``` - -在你的中间件文件中使用 `next("/")` 来重定向到不同的页面,然后调用下一个中间件函数: - -```js -// src/middleware.js -export function onRequest(ctx, next) { - if (!ctx.cookies.get("allowed")) { - return next("/") // 新签名 - } - return next(); -} -``` - -要全面了解并对这个实验性 API 提供反馈,请查看 [Rerouting RFC](https://github.com/withastro/roadmap/blob/feat/reroute/proposals/0047-rerouting.md)。 - ### experimental.env

@@ -1771,7 +1715,7 @@ const countries = defineCollection({ export const collections = { countries }; ``` -对于更高级的加载逻辑,你可以定义一个 loader 对象。这允许增量更新和条件加载,同时还可以完全访问数据存储。请查看 [Content Layer API RFC](https://github.com/withastro/roadmap/blob/content-layer/proposals/0047-content-layer.md#loaders) 中的 API。 +对于更高级的加载逻辑,你可以定义一个 loader 对象。这允许增量更新和条件加载,同时还可以完全访问数据存储。请查看 [Content Layer API RFC](https://github.com/withastro/roadmap/blob/content-layer/proposals/0050-content-layer.md#loaders) 中的 API。 #### 迁移现有内容集合以使用 Content Layer API @@ -1835,4 +1779,4 @@ export const collections = { countries }; #### 了解更多 -要全面了解并 [对这个实验性 API 提供反馈](https://github.com/withastro/roadmap/pull/982),请查看 [Content Layer API RFC](https://github.com/withastro/roadmap/blob/content-layer/proposals/0047-content-layer.md)。 +要全面了解并 [对这个实验性 API 提供反馈](https://github.com/withastro/roadmap/pull/982),请查看 [Content Layer API RFC](https://github.com/withastro/roadmap/blob/content-layer/proposals/0050-content-layer.md)。