Our open source module allows you to quickly add structured data markup (also known as Rich Snippets) to any Magento 2 store by simply installing our module and setting a few configuration options. Once this module is installed you will have valid structured data in the source of your product, contact and CMS pages. For example: https://developers.google.com/search/docs/advanced/structured-data/product
This will look similar to the below:
<script type="application/ld+json">
{
"@context": "https://schema.org/",
"@type": "Product",
"@id": "https://example.co.uk/blue-t-shirt#Product",
"brand": {
"@type": "Brand",
"name": "Nike"
},
"aggregateRating": {
"@type": "AggregateRating",
"bestRating": "100",
"worstRating": "1",
"ratingValue": "4.55",
"reviewCount": "5"
},
"name": "Nike Blue T-Shirt",
"sku": "blue-t-shirt",
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer viverra vitae nulla quis venenatis. Donec sollicitudin pharetra eros, in facilisis justo fringilla eu. In at consequat felis.",
"image": "https://example.co.uk/media/catalog/product/b/t/blue-t-shirt.jpg",
"offers": {
"@type": "Offer",
"url": "https://example.co.uk/blue-t-shirt",
"price": 18.99,
"priceCurrency": "GBP",
"priceSpecification": {
"@type": "UnitPriceSpecification",
"price": 18.99,
"priceCurrency": "GBP",
"valueAddedTaxIncluded": true
},
"availability": "http://schema.org/InStock",
"itemCondition": "http://schema.org/NewCondition"
}
}
</script>
The module provides the following structured data:
- @type
- @id
- name
- sku
- description
- image
- weight
- brand
- aggregateRating
- bestRating
- worstRating
- ratingValue
- reviewCount
- mpn
- material
- color
- price
- priceCurency
- valueAddedTaxIncluded
- availability
- itemCondition
- AggregateOffer
- offers
- highPrice
- lowPrice
- @type
- @id
- name
- image
- address
- telephone
- url
- geo
- name
- mainContentOfPage
- description
- primaryImageOfPage
composer require outeredge/magento-structured-data-module
Configuration is available in Stores > Configuration > outer/edge > Structured Data
. The following options are available:
- Enable: Enable or disable structured data on product pages.
- Use Short Description: Use
short_description
attribute for thedescription
markup. By defaultdescription
will be used. - Include ChildProducts: Choose whether to include individual offer for each child (simple) product for structured data on configurable product pages.
- Include Product Weights: Ad
weight
schema to product page structured data. - Product Brand/Manufacturer field: Choose which Magento attribute is used for the
brand
schema. If not specified the module will automatically check formanufacturer
andbrand
attributes.
- Enable: Enable or disable structured data on CMS pages.
- Enable About Page: Enable or disable
"@type": "AboutPage"
. - About Page: Select the CMS page for
"@type": "AboutPage"
.
- Enable: Enable or disable structured data on Contact page.
- Type: Select whether business in a Local Business or Organization.
- Latitude: Specify latitude for local business.
- Longitude: Specify longitude for local business.
Once the module is installed and configured you will find the schema markup in your source code:
Our structured data module provides for product schema to the built in Magento GraphGL endpoint. Simply request the structured_data
field with your product data as per the example below and the data will be returned as a JSON array:
{
products(
filter: {
...
}
) {
items {
sku
name
structured_data
}
}
}
https://developers.google.com/search/docs/guides/intro-structured-data https://developers.google.com/search/docs/advanced/structured-data/product