Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 41de576

Browse files
committed
docs(markdown): tip about defining excerpt field in schema
close #3041
1 parent 69a14fa commit 41de576

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

docs/content/docs/3.files/1.markdown.md

+17
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,23 @@ Description property will contain the excerpt content unless defined within the
522522

523523
If there is no `<!--more-->` divider in the text then excerpt is undefined.
524524

525+
::tip
526+
You should define the `excerpt` field in the collection schema if you want to use the excerpt feature.
527+
```ts [content.config.ts]
528+
const content = defineCollection({
529+
type: 'page',
530+
source: '**',
531+
schema: z.object({
532+
excerpt: z.object({
533+
type: z.string(),
534+
children: z.any(),
535+
}),
536+
}),
537+
})
538+
```
539+
Read more about the [collection schema](/docs/collections/define#collection-schema).
540+
::
541+
525542
Example variables will be injected into the document:
526543

527544
```json

0 commit comments

Comments
 (0)