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
Copy file name to clipboardExpand all lines: docs/content/docs/1.getting-started/3.collections.md
+65-3Lines changed: 65 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,11 +34,15 @@ export const collections = {
34
34
}
35
35
```
36
36
37
+
::note{to="#collection-types"}
38
+
Learn more about the different types of collections.
39
+
::
40
+
37
41
### Collection Schema
38
42
39
43
Schemas enforce data consistency within a collection and serve as the source of truth for TypeScript types.
40
44
41
-
Define a schema by adding the `schema` property to your collection by using a [`zod`](https://zod.dev) schema:
45
+
On top of the [built-in fields](#built-in-fields), you can define a schema by adding the `schema` property to your collection by using a [`zod`](https://zod.dev) schema:
42
46
43
47
```ts [content.config.ts]
44
48
import { defineCollection, z } from'@nuxt/content'
@@ -48,7 +52,7 @@ export const collections = {
48
52
source: '**.md',
49
53
type: 'page',
50
54
// Define custom schema for docs collection
51
-
schema: z.object({// Schema must be an object
55
+
schema: z.object({
52
56
tags: z.array(z.string()),
53
57
image: z.string(),
54
58
date: z.Date()
@@ -84,7 +88,7 @@ export const collections = {
84
88
85
89
## Querying Collections
86
90
87
-
Use the [`queryCollection`](/docs/composables/query-collection) util to fetch one or all items from a collection:
91
+
Use the [`queryCollection`](/docs/utils/query-collection) util to fetch one or all items from a collection:
Copy file name to clipboardExpand all lines: docs/content/docs/5.deploy/1.cloudflare.md
+6-8Lines changed: 6 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,16 +11,14 @@ If you use the [Cloudflare Pages GitHub/GitLab integration][1]{target="_blank"}
11
11
12
12
In order to publish your project, you need to create a Cloudflare D1 database and connect it to your project.
13
13
14
-
[Learn how to create a D1 database](https://developers.cloudflare.com/d1/get-started/#2-create-a-database)
14
+
-[Create a D1 database][d1]
15
+
- Link it to your Cloudflare Pages project using the `DB` binding name
15
16
16
-
## Database
17
-
18
-
Unfortunately SQLite database is not supported in cloudflare environment and you should use another database.
19
-
You can simply create a D1 database in cloudflare and use Content Module's D1 adapter.
20
-
21
-
- Use [Nuxt Hub](/docs/deploy/nuxthub) to create, connect and manage D1 database for you.
22
-
- Or create a D1 database from Cloudflare dashboard and connect it to you project by creating a `wrangler.toml` file in project root. [Get started with Cloudflare D1][d1]
17
+
Redeploy your project.
23
18
19
+
::tip
20
+
Checkout the [**NuxtHub Integration**](/docs/deploy/nuxthub) to deploy your Nuxt Content project on your Cloudflare account with zero configuration and maximum performance.
Copy file name to clipboardExpand all lines: docs/content/docs/5.deploy/2.nuxthub.md
+1-36Lines changed: 1 addition & 36 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,39 +5,4 @@ navigation:
5
5
icon: i-simple-icons-nuxtdotjs
6
6
---
7
7
8
-
Nuxt Content uses Nuxt deployment presets to adjust the build process for different hosting platforms. To deploy your Nuxt Content to Cloudflare, you can use the `cloudflare_pages`{lang="ts-type"} preset.
9
-
10
-
You can do that in two ways:
11
-
12
-
- By defining the `NITRO_PRESET`{lang="ts-type"} to `cloudflare_pages`{lang="ts-type"} when running the build process, like so:
13
-
14
-
```bash
15
-
NITRO_PRESET=cloudflare_pages npm run build
16
-
```
17
-
18
-
Or by updating your Nuxt configuration:
19
-
20
-
```bash
21
-
"preset": "cloudflare_pages",
22
-
```
23
-
24
-
If you use the [Cloudflare Pages GitHub/GitLab integration][1]{target="_blank"} Nuxt does not require configuration for presets.
25
-
26
-
## Database
27
-
28
-
Unfortunately sqlite database is not supported in cloudflare environment and you should use another database.
29
-
You can simply create a D1 database in cloudflare and use Content Module's D1 adapter.
30
-
31
-
- You can simply use [Nuxt Hub][nuxt-hub] to create, connect and manage D1 database for you.
32
-
- Or you can create it directly create a D1 database from Cloudflare dashboard and connect it to you project by creating a `wrangler.toml` file in project root. [Get started with Cloudflare D1][d1]
0 commit comments