Skip to content

Commit

Permalink
Merge branch 'main' into ci/docgen-integrations
Browse files Browse the repository at this point in the history
  • Loading branch information
delucis authored Sep 1, 2023
2 parents 9cfc459 + 586a848 commit dd06547
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 34 deletions.
2 changes: 1 addition & 1 deletion src/content/docs/es/core-concepts/routing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ export async function getStaticPaths({paginate}) {
// Para cada etiqueta, devuelve un resultado de paginate().
// Asegúrate de pasar `{params: {tag}}` a `paginate()`
// Así Astro sabrá qué agrupación de etiquetas usar.
return allTags.map((tag) => {
return allTags.flatMap((tag) => {
const filteredPosts = allPosts.filter((post) => post.frontmatter.tag === tag);
return paginate(filteredPosts, {
params: { tag },
Expand Down
4 changes: 2 additions & 2 deletions src/content/docs/es/guides/integrations-guide/cloudflare.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ Si estás usando el runtime `advanced`, puedes escribir el objeto `runtime` de l
```ts
// src/env.d.ts
/// <reference types="astro/client" />
import type { AdvancedRuntime } from '@astrojs/cloudflare';
type AdvancedRuntime = import('@astrojs/cloudflare').AdvancedRuntime;

declare namespace App {
interface Locals extends AdvancedRuntime {
Expand All @@ -140,7 +140,7 @@ Si estás usando el runtime `directory`, puedes escribir el objeto `runtime` de
```ts
// src/env.d.ts
/// <reference types="astro/client" />
import type { DirectoryRuntime } from '@astrojs/cloudflare';
type DirectoryRuntime = import('@astrojs/cloudflare').DirectoryRuntime;

declare namespace App {
interface Locals extends DirectoryRuntime {
Expand Down
1 change: 1 addition & 0 deletions src/content/docs/es/recipes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ Mira ejemplos guiados de cómo agregar características a tu proyecto de Astro.
- [Añade autenticación de nombre de usuario y contraseña con Lucia](https://lucia-auth.com/guidebook/sign-in-with-username-and-password/astro)
- [Añade Github OAuth con Lucia](https://lucia-auth.com/guidebook/github-oauth/astro)
- [Integrando Sentry con Astro](https://akashrajpurohit.com/blog/seamless-error-tracking-integrating-sentry-with-astro/)
- [Configura páginas de borrador de manera efectiva en Astro con autoría de contenido impulsada por configuración](https://akashrajpurohit.com/blog/set-up-draft-pages-effectively-in-astro-with-configdriven-content-authoring/)
2 changes: 1 addition & 1 deletion src/content/docs/zh-cn/core-concepts/routing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ export async function getStaticPaths({paginate}) {
// 每个标签都会返回 paginate() 结果。
// 确保将 `{params: {tag}}` 传递给 `paginate()`
// 这样 Astro 才知道怎么把这些结果进行分组
return allTags.map((tag) => {
return allTags.flatMap((tag) => {
const filteredPosts = allPosts.filter((post) => post.frontmatter.tag === tag);
return paginate(filteredPosts, {
params: { tag },
Expand Down
29 changes: 0 additions & 29 deletions src/content/docs/zh-cn/guides/server-side-rendering.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ title: 服务端渲染
i18nReady: true
---
import PackageManagerTabs from '~/components/tabs/PackageManagerTabs.astro'
import FileTree from '~/components/FileTree.astro';

服务器端渲染(SSR)是指按需在服务器上生成 HTML 页面并将其发送到客户端。

Expand Down Expand Up @@ -375,31 +374,3 @@ const factPromise = fetch('https://catfact.ninja/fact')

在此示例中,`一个名称`将在加载 `personPromise``factPromise` 时渲染。
一旦 `personPromise` 解决,`一个事实`就会出现,`factpromise` 将在加载完成后呈现。

### 将 SSR 构建拆分为多个文件

默认情况下,Astro 将所有页面构建到一个名为 `entry.mjs` 的单个文件中。你可以在构建选项中配置 [`split`](/zh-cn/reference/configuration-reference/#buildsplit),改为为每个页面发出一个文件:

```js title="astro.config.mjs" ins={6}
// astro.config.mjs
import { defineConfig } from 'astro/config';

export default defineConfig({
build: {
split: true
}
});
```

发出的页面文件将保存在为 [`outDir`](/zh-cn/reference/configuration-reference/#outdir) 指定的目录中,在新创建的 `pages/` 目录下。

构建的 `pages/` 目录中的文件将镜像 `src/pages/` 中页面文件的目录结构,例如:

<FileTree>
- dist/
- pages/
- blog/
- entry.\_slug\_.astro.mjs
- entry.about.astro.mjs
- entry.index.astro.mjs
</FileTree>
15 changes: 14 additions & 1 deletion src/content/docs/zh-cn/reference/adapter-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ title: Astro 适配器 API
---

import Since from '~/components/Since.astro';
import FileTree from '~/components/FileTree.astro';

Astro 可以轻松部署到任何云托管平台,以实现服务端渲染(SSR)。该能力由**适配器**[集成](/zh-cn/reference/integrations-reference/)提供,请参阅 [SSR 指南](/zh-cn/guides/server-side-rendering/#添加一个适配器) 了解如何使用现有的适配器。

Expand Down Expand Up @@ -304,7 +305,19 @@ Astro 将在终端中记录**警告**:
这是一个仅在使用 SSR 时启用的功能。默认情况下,Astro 会产出一个 `entry.mjs` 文件,该文件负责在每个请求上产出渲染的页面。

`functionPerRoute``true` 时,Astro 会为项目中定义的每个路由创建一个单独的文件。
每个文件都只会渲染一个页面。页面将在 `dist/pages/` 目录中产出,产出的文件将保持 `src/pages/` 目录的相同文件路径。

每个文件都只会渲染一个页面。页面将在 `dist/pages/` 目录下(或者在 [`outDir`](/zh-cn/reference/configuration-reference/#outdir) 所指定目录中的 `/pages/` 目录下)产出,产出的文件将保持与 `src/pages/` 目录相同的文件路径。

构建出的 `pages/` 目录下的文件,将会与 `src/pages/` 目录下的页面文件的目录结构保持一致,例如:

<FileTree>
- dist/
- pages/
- blog/
- entry.\_slug\_.astro.mjs
- entry.about.astro.mjs
- entry.index.astro.mjs
</FileTree>

通过将 `true` 传递给适配器来启用此功能。

Expand Down

0 comments on commit dd06547

Please sign in to comment.