Integrate an Editorial Section with Your Product Page
Enterprise plans
A common use case with a visual CMS is to have a region on your product page for adding more editorial about the given product — or for all products of a given type or collection. This could include content such as storytelling, imagery, videos, recommended products, and other merchandising.
Model definition
A standard section model named product-editorial is all you need.
By default you don't need any fields. Instead, this example uses targeting to decide where the section should display; such as for a given product or any product of a certain collection.
Custom targeting or an e-commerce plugin can help provide the UI fields for picking product and collections where this section shows.
Example Code
The Next.js shows and example in pages/products/[product].jsx:
Notice that RenderBuilderContent is a component you'd make, for example:
This example uses SvelteKit.
Add the following to nuxt.config.js:
If you are using an SSR framework other than Nuxt, you must import the CSS by adding the following to your entry point, before rendering Builder content:
Place the following into your .tsx file:
In product-editorial.resolver.ts, add the following:
- Import
BuilderContentandfetchOneEntryfrom@builder.io/sdk-angular. - Fetch the specific editorial using custom targeting with
userAttributes, by providing the URL path to fetch the editorial content. - Combine the product data from the API with the editorial data fetched from Builder.io and return both.
Import Builder and fetch the product-editorial, making sure to replace YOUR_PUBLIC_API_KEY with your Builder Public API Key.