You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Explore the `src/pages/` folder of the [blog tutorial demo code on GitHub](https://github.com/withastro/blog-tutorial-demo/tree/content-collections/src/pages) to see full examples of creating pages from your collections for blog features like a list of blog posts, tags pages, and more!
570
570
:::
571
571
572
+
## Collection JSON Schemas
573
+
574
+
<p><Sincev="4.13.0" /></p>
575
+
576
+
Astro auto-generates [JSON Schema](https://json-schema.org/) files for collections, which you can use in your editor to get IntelliSense and type-checking for data files.
577
+
578
+
A JSON Schema file is generated for each collection in your project and output to the `.astro/collections/` directory.
579
+
For example, if you have two collections, one named `authors` and another named `posts`, Astro will generate `.astro/collections/authors.schema.json` and `.astro/collections/posts.schema.json`.
580
+
581
+
### Use JSON Schemas in JSON files
582
+
583
+
You can manually point to an Astro-generated schema by setting the `$schema` field in your JSON file.
584
+
The value should be a relative file path from the data file to the schema.
585
+
In the following example, a data file in `src/data/authors/` uses the schema generated for the `authors` collection:
#### Use a schema for a group of JSON files in VS Code
596
+
597
+
In VS Code, you can configure a schema to apply for all files in a collection using the [`json.schemas` setting](https://code.visualstudio.com/docs/languages/json#_json-schemas-and-settings).
598
+
In the following example, all files in the `src/data/authors/` directory will use the schema generated for the `authors` collection:
599
+
600
+
```json
601
+
{
602
+
"json.schemas": [
603
+
{
604
+
"fileMatch": ["/src/data/authors/**"],
605
+
"url": "./.astro/collections/authors.schema.json"
606
+
}
607
+
]
608
+
}
609
+
```
610
+
611
+
### Use schemas in YAML files in VS Code
612
+
613
+
In VS Code, you can add support for using JSON schemas in YAML files using the [Red Hat YAML](https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml) extension.
614
+
With this extension installed, you can reference a schema in a YAML file using a special comment syntax:
See [“Associating schemas”](https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml#associating-schemas) in the Red Hat YAML extension documentation for more details.
638
+
572
639
## When to create a collection
573
640
574
641
You can [create a collection](#defining-collections) any time you have a group of related data or content that shares a common structure.
[Railway](https://railway.com) is a deployment platform built to simplify your infrastructure stack from servers to observability with a single, scalable platform.
12
14
15
+
This guide is for deploying an Astro static site to Railway using either the web interface or Railway CLI tool.
16
+
17
+
:::tip
18
+
To deploy an Astro site with on-demand rendering (SSR) using the Node adapter, you can follow [Railway's guide to deploying an Astro site](https://docs.railway.com/guides/astro).
19
+
:::
20
+
21
+
## Project Configuration
22
+
23
+
Railway's default build system, [Railpack](https://docs.railway.com/reference/railpack), automatically builds your Astro project as a static site.
24
+
25
+
## Deploy via the web interface
26
+
27
+
<Steps>
28
+
1. Create a [Railway account](https://railway.com/dashboard) and sign in.
29
+
30
+
2. From the Railway dashboard, create a new [project](https://docs.railway.com/guides/projects).
31
+
32
+
3. Select the option to deploy from a GitHub repository, and select your Astro project.
33
+
34
+
4. Generate or add a custom domain from your project's [network settings](https://docs.railway.com/guides/public-networking#railway-provided-domain).
35
+
</Steps>
36
+
37
+
## Deploy via Railway CLI
38
+
39
+
<Steps>
40
+
1.[Install](https://docs.railway.com/guides/cli#installing-the-cli) the Railway CLI tool.
41
+
42
+
2. Login with the command `railway login`.
43
+
44
+
3. From within your Astro project, run `railway init` and choose a workspace and project name.
45
+
46
+
4. Run `railway up` to deploy your project on Railway.
47
+
48
+
5. Run `railway domain` to generate a Railway provided service domain.
49
+
</Steps>
50
+
51
+
13
52
## Official Resources
14
53
15
54
[Railway guide to deploying an Astro app](https://docs.railway.com/guides/astro)
16
55
17
56
## Community Resources
18
57
19
-
[How to host an Astro site on Railway](https://jacksmith.xyz/blog/how-to-host-astro-site-on-railway)
58
+
[How to host an Astro site on Railway](https://jacksmith.xyz/blog/how-to-host-astro-site-on-railway)
This **[Astro integration][astro-integration]** enables rendering and client-side hydration for your [React](https://react.dev/) components.
14
15
@@ -114,6 +115,79 @@ To use your first React component in Astro, head to our [UI framework documentat
114
115
* 💧 client-side hydration options, and
115
116
* 🤝 opportunities to mix and nest frameworks together
116
117
118
+
## Integrate Actions with `useActionState()` (experimental)
119
+
120
+
The `@astrojs/react` integration provides two experimental functions for use with [Astro Actions][astro-actions]: `experimental_withState()` and `experimental_getActionState()`.
121
+
122
+
These are used with [React's useActionState() hook](https://react.dev/reference/react/useActionState) to read and update client-side state when triggering actions during form submission.
You can pass `experimental_withState()` and the action you want to trigger to React's `useActionState()` hook as the form action function. The example below passes a `like` action to increase a counter along with an initial state of `0` likes.
The `experimental_withState()` function will match the action's types with React's expectations and preserve metadata used for progressive enhancement, allowing it to work even when JavaScript is disabled on the user's device.
You can access the state stored by `useActionState()` on the server in your action `handler` with `experimental_getActionState()`. It accepts the [Astro API context](/en/reference/api-reference/#the-context-object), and optionally, you can apply a type to the result.
165
+
166
+
The example below gets the current value of likes from a counter, typed as a number, in order to create an incrementing `like` action:
Copy file name to clipboardExpand all lines: src/content/docs/es/basics/astro-pages.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -104,7 +104,7 @@ Esto generará una página `404.html` que la mayoría de los [servicios de despl
104
104
105
105
## Página de error 500 personalizada
106
106
107
-
Para que una página de error 500 personalizada se muestre para las páginas que se [renderizan bajo demanda](/es/guides/on-demand-rendering/), crea el archivo `src/pages/500.astro`. Esta página personalizada no está disponible para las páginas prerenderizadas y no puede ser prerenderizada.
107
+
Para que una página de error 500 personalizada se muestre para las páginas que se [renderizan bajo demanda](/es/guides/on-demand-rendering/), crea el archivo `src/pages/500.astro`. Esta página personalizada no está disponible para las páginas prerenderizadas.
108
108
109
109
Si se produce un error al renderizar esta página, se mostrará la página de error 500 predeterminada de tu host a tu visitante.
Copy file name to clipboardExpand all lines: src/content/docs/es/editor-setup.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -77,7 +77,7 @@ Las instrucciones de instalación, integración del editor e información adicio
77
77
78
78
### Prettier
79
79
80
-
[Prettier](https://prettier.io/) es un formateador popular para JavaScript, HTML, CSS y más. Si estás usando la [extensión de VS Code de Astro](https://marketplace.visualstudio.com/items?itemName=astro-build.astro-vscode) o [el servidor de lenguaje de Astro dentro de otro editor](#otros-editores-de-código), el formateo de código con Prettier está incluido.
80
+
[Prettier](https://prettier.io/) es un formateador popular para JavaScript, HTML, CSS y más. Si estás usando la [extensión de VS Code de Astro](https://marketplace.visualstudio.com/items?itemName=astro-build.astro-vscode), el formateo de código con Prettier está incluido.
81
81
82
82
Para dar soporte al formateo de archivos `.astro` fuera del editor (por ejemplo, CLI) o dentro de editores que no soportan nuestras herramientas de editor, instala [el plugin oficial de Prettier de Astro](https://github.com/withastro/prettier-plugin-astro).
Copy file name to clipboardExpand all lines: src/content/docs/fr/guides/authentication.mdx
+3-2Lines changed: 3 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,7 +25,7 @@ Auth.js est une solution d'authentification indépendante du framework. Un adapt
25
25
26
26
### Installation
27
27
28
-
Utilisez la commande `astro add` de votre gestionnaire de paquets préféré pour ajouter l'intégration `auth-astro`.
28
+
Utilisez la commande `astro add` de votre gestionnaire de paquets préféré pour ajouter l'intégration `auth-astro` à un projet Astro configuré avec un [adaptateur de serveur](/fr/guides/on-demand-rendering/#adaptateurs-de-serveur) pour le rendu à la demande.
29
29
30
30
<PackageManagerTabs>
31
31
<Fragmentslot="npm">
@@ -69,12 +69,13 @@ Pour installer `auth-astro` manuellement, installez le paquet requis pour votre
69
69
70
70
Ensuite, appliquez l'intégration à votre fichier `astro.config.*` en utilisant la propriété `integrations` :
La configuration donnée générera des fichiers de sitemap aux adresses `https://example.com/sitemap-astronomie-0.xml` et `https://example.com/sitemap-astronomie-index.xml`.
Un objet d’espaces de noms XML à exclure du sitemap généré.
529
+
530
+
L'exclusion des espaces de noms inutilisés peut aider à créer des sitemaps plus ciblés, plus rapides à analyser par les moteurs de recherche et utilisant moins de bande passante. Par exemple, si votre site ne propose pas des actualités, des vidéos ou de contenu multilingue, vous pouvez exclure ces espaces de noms pour réduire la surcharge XML.
531
+
532
+
Par défaut, tous les espaces de noms configurables (`news`, `xhtml`, `image` et `video`) sont inclus dans le sitemap généré en XML. Pour exclure un ou plusieurs de ces espaces de noms de la génération de votre sitemap, ajoutez un objet de configuration `namespaces` et définissez les options individuelles sur `false`.
533
+
534
+
```js title="astro.config.mjs" ins={8-11}
535
+
import { defineConfig } from'astro/config';
536
+
importsitemapfrom'@astrojs/sitemap';
537
+
538
+
exportdefaultdefineConfig({
539
+
site:'https://example.com',
540
+
integrations: [
541
+
sitemap({
542
+
namespaces: {
543
+
news:false,
544
+
xhtml:false,
545
+
}
546
+
})
547
+
]
548
+
});
549
+
```
550
+
519
551
## Exemples
520
552
521
553
* Le site officiel d'Astro utilise Astro Sitemap pour générer [son plan du site](https://astro.build/sitemap-index.xml).
Copy file name to clipboardExpand all lines: src/content/docs/ko/guides/astro-db.mdx
+1-5Lines changed: 1 addition & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -232,10 +232,6 @@ Astro DB를 사용하면 로컬 및 원격 데이터베이스에 모두 연결
232
232
233
233
호스팅된 원격 데이터베이스에 연결하려면 `--remote` 플래그를 사용합니다. 이 플래그를 사용하면 원격 데이터베이스에 대한 읽기 및 쓰기 액세스가 모두 가능하므로 프로덕션 환경에서 [사용자 데이터를 허용 및 유지](#insert)할 수 있습니다.
234
234
235
-
:::note
236
-
일반적으로 정적 또는 서버 렌더링 모드를 사용하는 모든 배포 플랫폼에서 원격 연결이 가능하지만, 현재 몇 가지 제한 사항이 있습니다. Cloudflare 및 Deno와 같은 Node 기반이 아닌 런타임은 현재 libSQL을 사용할 때 서버 렌더링 경로에서 DB를 지원하지 않습니다. 이러한 플랫폼에 대한 지원은 향후 구현될 예정입니다.
237
-
:::
238
-
239
235
`--remote` 플래그를 사용하도록 빌드 명령을 구성합니다:
240
236
241
237
```json title="package.json" "--remote"
@@ -260,7 +256,7 @@ astro dev --remote
260
256
개발 모드에서 `--remote`를 사용할 때는 주의하세요. 이렇게 하면 라이브 프로덕션 데이터베이스에 연결되며 모든 변경 사항 (삽입, 업데이트, 삭제)이 유지됩니다.
261
257
:::
262
258
263
-
`--remote` 플래그는 로컬 빌드와 서버에서 모두 원격 DB에 대한 연결을 사용합니다. 로컬 개발 환경과 배포 플랫폼 모두에서 필요한 환경 변수를 설정했는지 확인하세요.
259
+
`--remote` 플래그는 로컬 빌드와 서버에서 모두 원격 DB에 대한 연결을 사용합니다. 로컬 개발 환경과 배포 플랫폼 모두에서 필요한 환경 변수를 설정했는지 확인하세요. 또한 Cloudflare Workers나 Deno와 같은 Node.js가 아닌 런타임 환경에서는 [웹 모드를 구성](/ko/guides/integrations-guide/db/#mode)해야 할 수도 있습니다.
264
260
265
261
Astro DB 프로젝트를 배포할 때, 배포 플랫폼의 빌드 명령이 `package.json`에 구성된 `--remote` 플래그를 활용하도록 `npm run build` (또는 패키지 관리자에 상응하는 명령어)로 설정되어 있는지 확인하세요.
Astro DB는 Astro 생태계를 위해 설계된 완전 관리형 SQL 데이터베이스입니다. Astro에서 로컬로 개발하고 모든 [libSQL 호환 데이터베이스](/ko/guides/astro-db/)에 배포하세요.
16
17
@@ -92,6 +93,38 @@ export default defineDb({
92
93
})
93
94
```
94
95
96
+
## 구성
97
+
98
+
### `mode`
99
+
100
+
<p>
101
+
102
+
**타입:**`'node' | 'web'`<br />
103
+
**기본값:**`'node'`<br />
104
+
<Sincev="0.18.0"pkg="@astrojs/db" />
105
+
</p>
106
+
107
+
프로덕션 환경에서 데이터베이스에 연결할 때 사용할 드라이버를 구성합니다.
108
+
109
+
기본적으로 Astro DB는 프로덕션 배포에 Node.js 기반 libSQL 드라이버를 사용합니다. Node.js 런타임을 사용하는 대부분의 Astro 호스팅 또는 자체 호스팅 웹사이트에는 `node` 드라이버 모드로 충분합니다. 이를 통해 `memory:`, `file:`, `ws:`, `wss:`, `libsql`, `http`, `https` 등 여러 프로토콜을 통해 데이터베이스에 연결할 수 있으며, [임베디드 레플리카](/ko/guides/astro-db/#syncurl)와 같은 고급 기능도 사용할 수 있습니다.
110
+
111
+
Cloudflare Workers나 Deno와 같은 Node.js가 아닌 런타임의 서버리스 환경에 배포할 경우, 웹 기반 libSQL 드라이버를 사용할 수 있습니다. `web` 모드를 사용하여 배포할 경우, `libsql`, `http`, `https`를 통해 웹 기반 연결을 설정할 수 있습니다.
112
+
113
+
Node.js 환경이 아닌 경우 웹 libSQL 드라이버 모드를 사용하려면 어댑터 구성에서 `mode` 속성을 설정해야 합니다.
0 commit comments