From 1dac4d5e7f3a1d661e246f24a1abc5877baf172f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Thu, 7 Nov 2024 18:22:52 +0100 Subject: [PATCH] docs: update --- .../docs/1.getting-started/3.collections.md | 68 +++++++++- .../docs/3.composables/10.defineCollection.md | 116 ------------------ .../.navigation.yml | 1 + .../1.query-collection.md | 0 .../2.query-collection-navigation.md | 0 .../3.query-collection-item-surroundings.md | 0 .../4.query-collection-search-sections.md | 0 .../docs/4.components/0.content-renderer.md | 2 +- docs/content/docs/5.deploy/1.cloudflare.md | 14 +-- docs/content/docs/5.deploy/2.nuxthub.md | 37 +----- docs/content/docs/5.deploy/2.vercel.md | 13 +- 11 files changed, 86 insertions(+), 165 deletions(-) delete mode 100644 docs/content/docs/3.composables/10.defineCollection.md rename docs/content/docs/{3.composables => 3.utils}/.navigation.yml (64%) rename docs/content/docs/{3.composables => 3.utils}/1.query-collection.md (100%) rename docs/content/docs/{3.composables => 3.utils}/2.query-collection-navigation.md (100%) rename docs/content/docs/{3.composables => 3.utils}/3.query-collection-item-surroundings.md (100%) rename docs/content/docs/{3.composables => 3.utils}/4.query-collection-search-sections.md (100%) diff --git a/docs/content/docs/1.getting-started/3.collections.md b/docs/content/docs/1.getting-started/3.collections.md index ca23e1084..0cedf3091 100644 --- a/docs/content/docs/1.getting-started/3.collections.md +++ b/docs/content/docs/1.getting-started/3.collections.md @@ -34,11 +34,15 @@ export const collections = { } ``` +::note{to="#collection-types"} +Learn more about the different types of collections. +:: + ### Collection Schema Schemas enforce data consistency within a collection and serve as the source of truth for TypeScript types. -Define a schema by adding the `schema` property to your collection by using a [`zod`](https://zod.dev) schema: +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: ```ts [content.config.ts] import { defineCollection, z } from '@nuxt/content' @@ -48,7 +52,7 @@ export const collections = { source: '**.md', type: 'page', // Define custom schema for docs collection - schema: z.object({ // Schema must be an object + schema: z.object({ tags: z.array(z.string()), image: z.string(), date: z.Date() @@ -84,7 +88,7 @@ export const collections = { ## Querying Collections -Use the [`queryCollection`](/docs/composables/query-collection) util to fetch one or all items from a collection: +Use the [`queryCollection`](/docs/utils/query-collection) util to fetch one or all items from a collection: ```vue [pages/blog.vue]