resolveContent
Learn how to resolve Croct content in a Storyblok story.
This function walks a Storyblok content tree and replaces every block linked to a Croct slot with the personalized content fetched from Croct, converted to the Storyblok shape.
It is the low-level building block that withCroct uses internally, exposed for custom integrations that the platform wrappers do not cover. When a fetch returns no content or fails, the block keeps its original content.
Signature
This function has the following signature:
function resolveContent(content: unknown, fetcher: ContentFetcher): Promise<unknown>This function returns a copy of the content with every linked block resolved.
Example
Here is a basic example of how to use this function with the JavaScript SDK:
import {resolveContent} from '@croct/plug-storyblok';import croct from '@croct/plug';
const personalizedStory = await resolveContent( story, slotId => croct.fetch(slotId, {includeSchema: true}),);The fetcher must request the content schema so the conversion to the Storyblok shape can be schema-driven.
Parameters
The following list describes the supported parameters: