spiritracking-arch

payload plugin seo jsonld

by spiritracking-arch
SEO & metadata
v3
^3.0.0
MIT

Overview

Summary generated from the README

Provides helper functions that generate JSON-LD objects for Payload CMS v3 e-commerce sites so Google can show rich snippets. You call the builders in your Next.js pages and layouts and render the output in script tags. An optional plugin entry in the Payload config sets the currency. Product documents should be fetched with depth 3 so categories and their parents are populated.

Features

  • Product JSON-LD using AggregateOffer with lowPrice and stock status
  • Optional AggregateRating from your own review data
  • BreadcrumbList that follows nested category hierarchies
  • ItemList for shop and category pages, returning null for empty lists
  • WebSite with SearchAction and Organization builders
  • Converts prices stored in cents into decimal currency amounts

Use cases

  • Add product rich snippets with prices and star ratings to a Payload online shop
  • Show breadcrumb trails and product carousels in Google search results
  • Declare site and brand identity in the root layout of a Next.js storefront

From the author

Schema.org JSON-LD utilities for Payload CMS v3 e-commerce — Product, BreadcrumbList, ItemList, WebSite, Organization. Enables Google rich snippets with zero config.

Installation

npm i payload-plugin-seo-jsonld

1

Stars

0

Forks

0

Open Issues

1 months ago

Last Updated

7

Weekly Downloads

v1.0.2

npm Version

21.6 KB

Unpacked Size

0

Dependencies

GitHub stars

1+1 since Sep 7

Show data
GitHub stars by day (UTC)
DateStars
Dec 6, 20261
Dec 5, 20261
Dec 4, 20261
Dec 3, 20261
Dec 2, 20261
Dec 1, 20261
Nov 30, 20261
Nov 29, 20261
Nov 28, 20261
Nov 27, 20261
Nov 26, 20261
Nov 25, 20261
Nov 24, 20261
Nov 23, 20261
Nov 22, 20261
Nov 21, 20261
Nov 20, 20261
Nov 19, 20261
Nov 18, 20261
Nov 17, 20261
Nov 16, 20261
Nov 15, 20261
Nov 14, 20261
Nov 13, 20261
Nov 12, 20261
Nov 11, 20261
Nov 10, 20261
Nov 9, 20261
Nov 8, 20261
Nov 7, 20261
Nov 6, 20261
Nov 5, 20261
Nov 4, 20261
Nov 3, 20261
Nov 2, 20261
Nov 1, 20261
Oct 31, 20261
Oct 30, 20261
Oct 29, 20261
Oct 28, 20261
Oct 27, 20261
Oct 26, 20261
Oct 25, 20261
Oct 24, 20261
Oct 23, 20261
Oct 22, 20261
Oct 21, 20261
Oct 20, 20261
Oct 19, 20261
Oct 18, 20261
Oct 17, 20261
Oct 16, 20261
Oct 15, 20261
Oct 14, 20261
Oct 13, 20261
Oct 12, 20261
Oct 11, 20260
Oct 10, 20260
Oct 9, 20260
Oct 8, 20260
Oct 7, 20260
Oct 6, 20260
Oct 5, 20260
Oct 4, 20260
Oct 3, 20260
Oct 2, 20260
Oct 1, 20260
Sep 30, 20260
Sep 29, 20260
Sep 28, 20260
Sep 27, 20260
Sep 26, 20260
Sep 25, 20260
Sep 24, 20260
Sep 23, 20260
Sep 22, 20260
Sep 21, 20260
Sep 20, 20260
Sep 19, 20260
Sep 18, 20260
Sep 17, 20260
Sep 16, 20260
Sep 15, 20260
Sep 14, 20260
Sep 13, 20260
Sep 12, 20260
Sep 11, 20260
Sep 10, 20260
Sep 9, 20260
Sep 8, 20260
Sep 7, 20260
npm weekly downloads

8−2 since Sep 7

Show data
npm weekly downloads by day (UTC)
DateWeekly downloads
Dec 6, 20268
Dec 5, 20266
Dec 4, 20266
Dec 3, 20266
Dec 2, 202610
Dec 1, 20269
Nov 30, 202612
Nov 29, 202613
Nov 28, 202614
Nov 27, 202613
Nov 26, 202615
Nov 25, 202611
Nov 24, 202610
Nov 23, 20268
Nov 22, 20269
Nov 21, 202610
Nov 20, 202612
Nov 19, 202614
Nov 18, 202614
Nov 17, 202615
Nov 16, 202616
Nov 15, 202614
Nov 14, 202613
Nov 13, 202616
Nov 12, 202617
Nov 11, 202616
Nov 10, 202618
Nov 9, 202616
Nov 8, 202618
Nov 7, 202626
Nov 6, 202626
Nov 5, 202623
Nov 4, 202626
Nov 3, 202638
Nov 2, 202645
Nov 1, 202643
Oct 31, 202636
Oct 30, 202631
Oct 29, 202629
Oct 28, 202626
Oct 27, 202615
Oct 26, 20268
Oct 25, 202611
Oct 24, 202612
Oct 23, 202611
Oct 22, 202638
Oct 21, 202663
Oct 20, 2026350
Oct 19, 2026350
Oct 18, 2026347
Oct 17, 2026345
Oct 16, 2026345
Oct 15, 2026319
Oct 14, 2026294
Oct 13, 20263
Oct 12, 20263
Oct 11, 20263
Oct 10, 20262
Oct 9, 20262
Oct 8, 20261
Oct 7, 20261
Oct 6, 20261
Oct 5, 20261
Oct 4, 20260
Oct 3, 20260
Oct 2, 20261
Oct 1, 20261
Sep 30, 20261
Sep 29, 20261
Sep 28, 20261
Sep 27, 20262
Sep 26, 20266
Sep 25, 20266
Sep 24, 20266
Sep 23, 20266
Sep 22, 20267
Sep 21, 20267
Sep 20, 20267
Sep 19, 20263
Sep 18, 20263
Sep 17, 20264
Sep 16, 20265
Sep 15, 20265
Sep 14, 20267
Sep 13, 20267
Sep 12, 20267
Sep 11, 20267
Sep 10, 20266
Sep 9, 20267
Sep 8, 20267
Sep 7, 202610

Each point is npm's rolling 7-day download count.

Health Score

61/100Good

Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.

Badge for your README

Payload Directory health badge
Markdown
[![Payload Directory](https://payloaddirectory.dev/badge/1270763175-root.svg)](https://payloaddirectory.dev/plugins/1270763175-root)
HTML
<a href="https://payloaddirectory.dev/plugins/1270763175-root"><img src="https://payloaddirectory.dev/badge/1270763175-root.svg" alt="Payload Directory"></a>
Updated Oct 11, 2026Created Jun 16, 2026Published Oct 11, 2026

README

payload-plugin-seo-jsonld

npm version npm downloads GitHub stars Payload v3 License: MIT

Schema.org JSON-LD utilities for Payload CMS v3 e-commerce. Enables Google rich snippets (product cards, carousels, breadcrumbs) with battle-tested helpers built on real production deployments across 23 European shops.

⭐ If this plugin saves you time, star it on GitHub. It is the main way other Payload developers find it.

Features

  • 🛍️ Product — AggregateOffer with lowPrice, stock status, variants support
  • ⭐ AggregateRating — plug in your review data for star ratings in Google
  • 🧭 BreadcrumbList — nested category hierarchy (parent → child → product)
  • 📋 ItemList — shopping carousel for shop/category pages
  • 🌐 WebSite — SearchAction for Google Sitelinks Searchbox
  • 🏢 Organization — brand identity in search results
  • 🔒 Anti-duplicate protection for ItemList (Google invalidates 2+ per page)
  • 💶 Automatic price conversion from cents to euros (or any currency)

Installation

npm install payload-plugin-seo-jsonld

Usage

1. Add to your Payload config (optional)

// payload.config.ts
import { seoJsonLdPlugin } from 'payload-plugin-seo-jsonld'

export default buildConfig({
  plugins: [
    seoJsonLdPlugin({ currency: 'EUR' }),
  ],
})

2. Product page — Product + BreadcrumbList

// src/app/(app)/products/[slug]/page.tsx
import { buildProductJsonLd, buildBreadcrumbJsonLd } from 'payload-plugin-seo-jsonld'

export default async function ProductPage({ params }) {
  const product = await fetchProduct(params.slug)
  const siteUrl = process.env.NEXT_PUBLIC_SERVER_URL!

  const productJsonLd = buildProductJsonLd({
    product,
    siteUrl,
    currency: 'EUR',
    // Optional: plug in review data
    averageRating: 4.8,
    reviewCount: 42,
  })

  const breadcrumbJsonLd = buildBreadcrumbJsonLd({ product, siteUrl })

  return (
    <>
      <script
        type="application/ld+json"
        dangerouslySetInnerHTML={{ __html: JSON.stringify(productJsonLd) }}
      />
      <script
        type="application/ld+json"
        dangerouslySetInnerHTML={{ __html: JSON.stringify(breadcrumbJsonLd) }}
      />
      {/* your page content */}
    </>
  )
}
// src/app/(app)/shop/page.tsx
import { buildItemListJsonLd } from 'payload-plugin-seo-jsonld'

export default async function ShopPage() {
  const products = await fetchProducts()
  const siteUrl = process.env.NEXT_PUBLIC_SERVER_URL!

  // ⚠️ Only one ItemList per page — Google invalidates duplicates
  const itemListJsonLd = buildItemListJsonLd({
    products: products.docs,
    siteUrl,
    currency: 'EUR',
    listName: 'Our Products',
  })

  return (
    <>
      {itemListJsonLd && (
        <script
          type="application/ld+json"
          dangerouslySetInnerHTML={{ __html: JSON.stringify(itemListJsonLd) }}
        />
      )}
      {/* your page content */}
    </>
  )
}

4. Root layout — WebSite + Organization

// src/app/layout.tsx
import { buildWebSiteJsonLd, buildOrganizationJsonLd } from 'payload-plugin-seo-jsonld'

export default function RootLayout({ children }) {
  const siteUrl = process.env.NEXT_PUBLIC_SERVER_URL!

  const websiteJsonLd = buildWebSiteJsonLd({
    siteUrl,
    siteName: 'My Shop',
    description: 'Premium jewelry across Europe',
  })

  const orgJsonLd = buildOrganizationJsonLd({
    siteUrl,
    name: 'My Shop',
    logo: `${siteUrl}/logo.png`,
  })

  return (
    <html>
      <body>
        <script
          type="application/ld+json"
          dangerouslySetInnerHTML={{ __html: JSON.stringify(websiteJsonLd) }}
        />
        <script
          type="application/ld+json"
          dangerouslySetInnerHTML={{ __html: JSON.stringify(orgJsonLd) }}
        />
        {children}
      </body>
    </html>
  )
}

API Reference

buildProductJsonLd(options)

OptionTypeDefaultDescription
productobjectrequiredPayload product document
siteUrlstringrequiredBase URL (e.g. https://myshop.com)
currencystring'EUR'ISO 4217 currency code
averageRatingnumber—Average review rating
reviewCountnumber—Number of reviews

buildBreadcrumbJsonLd(options)

OptionTypeDescription
productobjectPayload product with populated categories
siteUrlstringBase URL

Supports nested categories: Shop → Parent Category → Sub Category → Product

buildItemListJsonLd(options)

OptionTypeDefaultDescription
productsarrayrequiredArray of Payload product docs
siteUrlstringrequiredBase URL
currencystring'EUR'ISO 4217 currency code
listNamestring'Products'Name of the list

Returns null if products array is empty — safe to use with conditional rendering.

buildWebSiteJsonLd(options)

OptionTypeDescription
siteUrlstringBase URL
siteNamestringSite name
descriptionstringOptional description

buildOrganizationJsonLd(options)

OptionTypeDescription
siteUrlstringBase URL
namestringOrganization name
logostringLogo URL
descriptionstringOptional description

Important Notes

  • Prices in cents — Payload stores prices in cents (3990 = €39.90). This plugin automatically divides by 100.
  • ItemList deduplication — Google invalidates pages with 2+ ItemList scripts. Always check before adding.
  • lowPrice not price — Google requires lowPrice for AggregateOffer validation. This plugin handles it correctly.
  • Depth 3 required — Make sure to fetch products with depth: 3 to populate categories and their parents.

Verification

# Check lowPrice on product page
curl -s "https://myshop.com/products/my-product" | grep "lowPrice"

# Check single ItemList on shop page
curl -s "https://myshop.com/shop" | grep -o '"@type":"ItemList"' | wc -l
# → must return 1

Test with Google Rich Results Test.

About the author

I'm Camille Guerineau. I spent ten years as a jewelry maker and founder of Loch Ness Paris before going back to full-stack development. I build Payload CMS shops for real e-commerce, and I publish the pieces that were missing.

Need help with a Payload CMS v3 shop, SEO or rich snippets? Get in touch through lochness-paris.com.

License

MIT © Camille Guerineau

Similar plugins