Builder.io Integration¶
Builder.io is a headless CMS that provides a visual editor for creating and managing content. The integration with Builder.io allows you to create and manage content in Builder.io and display it in the Virto Commerce vue-b2b-theme. The integration is achieved through the use of the Builder.io API, which allows you to fetch content from Builder.io and display it in the vue-b2b-theme. The integration also provides a way to manage content in Builder.io and update it in the vue-b2b-theme.
This guide explores how to integrate Builder.io with the Virto Commerce vue-b2b-theme and provides a practical example of the integration.
Integrate with Virto Commerce vue-b2b-theme¶
To integrate with the Virto Commerce vue-b2b-theme:
- Create a Builder.io account. Sign up for a free account on the Builder.io website.
- Create a space in Builder.io. A space is a container for your content, and it allows you to organize and manage your content in Builder.io.
- Create custom components in Builder.io. This allows you to add existing components from the Virto Commerce vue-b2b-theme to Builder.io and use them to create content.
- Create content in Builder.io by adding components to your space and filling them with content.
- Fetch content in the vue-b2b-theme using the Builder.io API. The Builder.io API provides a way to fetch content from Builder.io and display it in the vue-b2b-theme. You can fetch content using Builder.io composable, where you should pass content ID. The Builder.io API returns the content as JSON, which you can then display in the vue-b2b-theme.
Connect Builder.io with Virto Commerce vue-b2b-theme¶
To connect Builder.io with VC vue-b2b-theme:
-
Install
@builder.io/sdk-vue
, Builder.io SDK for Vue 3. We use@builder.io/sdk-vue
version 0.3.1, as it is more stable and has better compatibility with the Virto Commerce vue-b2b-theme. -
Get your Builder.io API token from the Builder.io dashboard (Your space → Settings → Public API Key). You will use this key to authenticate your requests to the Builder.io API.
-
To facilitate registration of the custom components, create a composable
useBuilder
:shared/builder-io/composables/useBuilder.ts