You are here:
JSON-LD Examples by Scope
Use these B2C Commerce JSON-LD templates as starting points for each page meta tag scope.
You can create a JSON-LD rule in any scope that page meta tags support. Each scope exposes
different data to your ${...} tokens. Enter tokens without surrounding
quotation marks; B2C Commerce quotes each resolved value as a JSON string. For the complete
list of objects and operators available in each scope, see Meta Tag Syntax.
| Scope | Pages | Available data |
|---|---|---|
| Product Detail Page | Product detail pages (PDP) | Product, ProductPrice, ProductImageURL, Category, Site |
| Product Listing Page | Category and product listing pages (PLP) | Category, search refinements, Site |
| Content Detail Page | Content detail pages (CDP) | Content, Folder, Site |
| Content Listing Page | Content folder and listing pages (CLP) | Folder, Site |
| Home Page | Site home page | Site |
These examples use common Schema.org types with a few product, category, content, and site attributes. Adjust the attributes to match your catalog and content, and validate the output.
Product Detail Page
Emit a Product for the product on the page.
{
"@context": "https://schema.org",
"@type": "Product",
"name": ${Product.name},
"brand": ${Product.brand},
"offers": {
"@type": "Offer",
"price": ${ProductPrice.min},
"priceCurrency": ${ProductPrice.currency}
}
}Product Listing Page
Emit a CollectionPage for the category. A rule resolves against a single
object, so you can't list each product on the page—describe the category instead.
{
"@context": "https://schema.org",
"@type": "CollectionPage",
"name": ${Category.displayName},
"url": ${OriginalRequestURL}
}Content Detail Page
Emit an Article, or another appropriate type, for the content asset on the
page.
{
"@context": "https://schema.org",
"@type": "Article",
"headline": ${Content.name},
"url": ${OriginalRequestURL}
}Content Listing Page
Emit a CollectionPage for the content folder.
{
"@context": "https://schema.org",
"@type": "CollectionPage",
"name": ${Folder.displayName},
"url": ${OriginalRequestURL}
}Home Page
Emit a WebSite for your storefront.
{
"@context": "https://schema.org",
"@type": "WebSite",
"name": ${Site.displayName},
"url": ${OriginalRequestURL}
}Fallbacks with Operators
B2C Commerce omits the entire block if the resolved content isn't valid JSON. Use the
ELSE operator to fall back to a value that's always present when a token
can resolve empty. A product's localized name can be empty in some locales, but its ID is
always set, so Product.ID is a safe fallback for the name:
{
"@context": "https://schema.org",
"@type": "Product",
"name": ${Product.name ELSE Product.ID},
"offers": {
"@type": "Offer",
"price": ${ProductPrice.min},
"priceCurrency": ${ProductPrice.currency}
}
}Choose a fallback that's accurate data. Don't substitute a placeholder, such as a constant
brand name, unless you are sure it's correct in all cases. Operators substitute a value, but
they don't remove a whole "key": value line and its trailing comma, so for a
field that's genuinely optional, leave it out of the template rather than fabricating a
value.

