Search by

taurus-media / module-structured-data-category

taurus-media

Magento 2 module to add CollectionPage structured data to category pages

Package info

github.com/taurus-media/module-structured-data-category

Type:magento2-module

pkg:composer/taurus-media/module-structured-data-category

Statistics

Installs: 18

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.0 2026-10-26 07:20 UTC

This package is auto-updated.

Last update: 2026-10-26 07:33:41 UTC


README

Adds CollectionPage structured data (JSON-LD) to category pages.

Features

  • Outputs a CollectionPage JSON-LD block on catalog_category_view.
  • Includes publisher (Organization with store logo), BreadcrumbList and an ItemList of products on the current page.
  • Breadcrumbs are taken from the breadcrumbs layout block, products from the category.products.list layout block. The markup always matches what's visible on the page (pagination, filters, sorting).
  • Optional Offer element per product (price, currency, availability, condition).
  • Optional OfferShippingDetails with configurable rates and destination.
  • Store-view-level configuration.

Installation

Composer (Recommended)

  1. Open your terminal and navigate to your Magento 2 root directory.
  2. Run the following command:
    composer require taurus-media/module-structured-data-category
  3. Enable the module:
    bin/magento module:enable Taurus_StructuredDataCategory
    bin/magento setup:upgrade
    bin/magento setup:di:compile
    bin/magento cache:flush

Configuration

  1. Log in to the Magento 2 Admin panel.
  2. Navigate to Stores > Settings > Configuration.
  3. Go to Taurus > Structured Data Category > CollectionPage.
  4. Available settings:
Setting Default Description
Enabled Yes Output the CollectionPage markup on category pages.
Add Product Offers Yes Add the offers element to each product.
Add Offer Shipping Details No Add shippingDetails to each offer. Shown only when offers are enabled.
Shipping Min Rate – shippingRate.minValue. Shown only when shipping details are enabled.
Shipping Max Rate – shippingRate.maxValue. Shown only when shipping details are enabled.
Shipping Destination – shippingDestination.name, e.g. Global. Optional.

shippingDetails is skipped if both rates are empty.

  1. Click Save Config and flush the cache.

Output Example

{
  "@context": "https://schema.org",
  "@type": "CollectionPage",
  "@id": "https://example.com/gear/bags.html#collectionpage",
  "name": "Bags",
  "url": "https://example.com/gear/bags.html",
  "description": "Bags",
  "publisher": {
    "@type": "Organization",
    "@id": "https://example.com/#organization",
    "name": "Example Store",
    "url": "https://example.com/",
    "logo": { "@type": "ImageObject", "url": "https://example.com/media/logo/default/logo.png" }
  },
  "breadcrumb": {
    "@type": "BreadcrumbList",
    "itemListElement": [
      { "@type": "ListItem", "position": 1, "name": "Home", "item": "https://example.com/" },
      { "@type": "ListItem", "position": 2, "name": "Gear", "item": "https://example.com/gear.html" },
      { "@type": "ListItem", "position": 3, "name": "Bags", "item": "https://example.com/gear/bags.html" }
    ]
  },
  "mainEntity": {
    "@type": "ItemList",
    "@id": "https://example.com/gear/bags.html#PLP",
    "url": "https://example.com/gear/bags.html",
    "numberOfItems": 1,
    "itemListElement": [
      {
        "@type": "ListItem",
        "position": 1,
        "item": {
          "@type": "Product",
          "url": "https://example.com/push-it-messenger-bag.html",
          "name": "Push It Messenger Bag",
          "id": "https://example.com/push-it-messenger-bag.html#PDP",
          "offers": {
            "@type": "Offer",
            "priceCurrency": "USD",
            "price": 45,
            "itemCondition": "https://schema.org/NewCondition",
            "availability": "https://schema.org/InStock",
            "url": "https://example.com/push-it-messenger-bag.html",
            "shippingDetails": {
              "@type": "OfferShippingDetails",
              "shippingRate": { "@type": "MonetaryAmount", "minValue": 5.99, "maxValue": 49.99, "currency": "USD" },
              "shippingDestination": { "@type": "DefinedRegion", "name": "Global" }
            }
          }
        }
      }
    ]
  }
}

Notes

  • mainEntity is omitted for categories with the "Static block only" display mode.
  • The core breadcrumbs block has no public getter for its crumbs, so Plugin\BreadcrumbsPlugin keeps a copy of them in the block's crumbs_list data.
  • JSON is encoded with JSON_HEX_TAG | JSON_HEX_AMP, so admin-entered values can't break out of the <script> tag.
  • Hyvä's breadcrumbs template outputs its own standalone BreadcrumbList. Both blocks can coexist.

License

MIT