Skip to content

Commit 1b331cb

Browse files
committed
docs(@sanity/presets): move link configuration patterns to first
1 parent 6b7529b commit 1b331cb

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

plugins/@sanity/presets/README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,20 @@ The `objects` option only toggles embedded objects on or off. To reshape the arr
346346

347347
## Recommended patterns
348348

349+
### Configure links globally
350+
351+
The [link preset](#link) is used by multiple other presets ([CTA](#cta-call-to-action), [rich text](#rich-text)). Configure `internalTypes` at the registry level so all links share the same set of linkable document types:
352+
353+
```ts
354+
const {defineLink, defineCta, definePage} = createPresetsRegistry({
355+
link: {
356+
internalTypes: ['page', 'post', 'product'],
357+
},
358+
})
359+
```
360+
361+
This single configuration flows into every `defineLink`, `defineCta`, and `defineRichText` call from this registry. Override at the call site only when a specific instance needs different behaviour.
362+
349363
### Use presets alongside custom types
350364

351365
Presets are not intended to replace all content modelling. They provide opinionated defaults for common patterns — pages, links, images, metadata — but your schema will likely include custom types that are specific to your project.
@@ -429,17 +443,3 @@ A few guidelines for using map hooks:
429443

430444
- If you find yourself heavily rewriting the produced schema type with map hooks, it may be a sign that you should model the content type yourself. See the [schema type documentation](https://www.sanity.io/docs/apis-and-sdks/introduction-to-schemas) for more.
431445
- If you use map hooks to rename fields, existing documents may need to be migrated to reflect the new field names. See the [schema and content migrations documentation](https://www.sanity.io/docs/content-lake/schema-and-content-migrations).
432-
433-
### Configure links globally
434-
435-
The [link preset](#link) is used by multiple other presets ([CTA](#cta-call-to-action), [rich text](#rich-text)). Configure `internalTypes` at the registry level so all links share the same set of linkable document types:
436-
437-
```ts
438-
const {defineLink, defineCta, definePage} = createPresetsRegistry({
439-
link: {
440-
internalTypes: ['page', 'post', 'product'],
441-
},
442-
})
443-
```
444-
445-
This single configuration flows into every `defineLink`, `defineCta`, and `defineRichText` call from this registry. Override at the call site only when a specific instance needs different behaviour.

0 commit comments

Comments
 (0)