Last updated

Structured Data

The Flight framework uses JSON-LD to embed structured data on product pages by default.

If you would like to modify the structured product data or embed your own (for category listings, for example), there are components in the template to assist with this.

StructuredData

import { StructuredData } from '@jetshop/core/components/StructuredData'

This component can be useful if you want to embed your own structured data.

Example usage:

<StructuredData
  json={{
    "@context": "http://schema.org/",
    "@type": "Thing",
    name: "Schema.org Ontology",
    subjectOf: {
      "@type": "Book",
      name: "The Complete History of Schema.org",
    },
  }}
/>

StructuredProductData

import { StructuredProductData } from '@jetshop/core/components/StructuredData/'

This component can be used if you'd like to customise the embedded product data.

If you do use this component, you should first disable the default product data embed. You can do that by adding this to your shop.config.js:

  structuredData: {
    disableDefaultProductData: true
  }

Example usage:

<StructuredProductData product={product} extraFields={{ mpn: "customMPN" }} />

StructuredCategoryData

import { StructuredCategoryData } from '@jetshop/core/components/StructuredData/'

This component can be used if you'd like to customise the embedded product data.

If you do use this component, you should first disable the default product data embed. You can do that by adding this to your shop.config.js:

  structuredData: {
    disableDefaultCategoryData: true
  }

Example usage:

<StructuredCategoryData
  category={category}
  extraFields={{ mpn: "customMPN" }}
/>