New guide: AI is in production. Is your governance?

Announcing Visual Copilot - Figma to production in half the time

Builder.io
Builder.io
Contact sales

New guide: AI is in production. Is your governance?

Announcing Visual Copilot - Figma to production in half the time

Builder Blueprints

Landing pages
Blog Article
Hero Section
Navigation Links
Announcement Bar
Product Details
Product Editorial
Homepage
Request a blueprintGo to developer docs

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:

import { BuilderComponent, builder } from '@builder.io/react';

// Replace with your Public API Key.
builder.init(YOUR_API_KEY);

export async function getStaticProps({ params }) {

    // Get the product details from your ecom backend
  const product = await getProduct(params.product)
  
  const editorial = await builder
    .get('product-editorial', { 
      userAttributes: { 
        // This helps you target different product editorials
        // to different URL paths. Optionally add other properties to target
        // on here too
        urlPath: `/products/${params.product}`,
        // Allow targeting a section by a specific product ID (or perhaps handle)
        productId: product.id,
        // Optionally, allow targeting any product in a collection
        collection: product.collection
      } 
    })
    .toPromise();

  return {
    props: {
      product,
      editorial: editorial || null,
    },
  };
}

export default function Page({ editorial, product }) {
  return (
    <>
      {/* Put your header here. */}
      <YourHeader />
      
      <YourProductInfo product={product} />

      <BuilderComponent model="product-editorial" content={editorial} />

      {/* Put the rest of your page here. */}
      <YourFooter />
    </>
  );
}

Product

Visual CMS

Theme Studio for Shopify

Sign up

Login

Featured Integrations

React

Angular

Next.js

Gatsby

Get In Touch

Chat With Us

Twitter

Linkedin

Careers

© 2020 Builder.io, Inc.

Security

Privacy Policy

Terms of Service

Get the latest from Builder

By submitting, you agree to our Privacy Policy.

  • Fusion

  • Publish

  • Product Updates

  • Figma to Code Guide

  • Headless CMS Guide

  • Headless Commerce Guide

  • Composable DXP Guide

Security

Privacy Policy

SaaS Terms

Trust Center

Cookie Preferences