infrangible / m2-catalog-seo
Adds structured data (rich snippets) for website, organization and products, Open Graph and Twitter Card tags, canonical links for home and CMS pages, and limits for title and description length.
Package info
github.com/infrangible-dev/m2-catalog-seo
Type:magento2-module
pkg:composer/infrangible/m2-catalog-seo
Requires
- php: >=8.1
- ext-mbstring: *
- fewedev/base: ~2.4.3
- infrangible/m2-core: ~5.0.9
- infrangible/m2-foundation: ~3.0.2
- infrangible/m2-sitemap: ~3.0.1
- magento/framework: ~103.0.6
- magento/module-catalog: ~104.0.6
- magento/module-cms: ~104.0.6
- magento/module-config: ~101.2.6
- magento/module-configurable-product: ~100.4.6
- magento/module-eav: ~102.1.6
- magento/module-grouped-product: ~100.4.6
- magento/module-review: ~100.4.6
- magento/module-store: ~101.1.6
- psr/log: ~2.0.0||~3.0.0
Requires (Dev)
- infrangible/phpstan-magento: ~1.2.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Adds structured data (rich snippets) for the website, the organization and products, Open Graph, Facebook and Twitter Card tags, canonical links for the home page and CMS pages, meta titles and descriptions of products from templates, limits for the length of titles and descriptions, and a PageMap for the sitemap of Infrangible Sitemap.
Structured data
The data is added as JSON-LD (<script type="application/ld+json">) to the head of all pages:
- WebSite: base URL and name of the store, optionally with a search action that points to the search results.
- Organization: the shop as a store of a chosen schema.org type (for example ClothingStore), with name, logo, description, email, phone, address, opening hours, accepted currencies and payments, price range and profiles in social networks ("Same As"). Settings with several lines (for example opening hours) become lists.
- Product (product pages): name, SKU, URL, image, the categories of the product in the store, an offer with price,
currency and availability, the average rating and the approved reviews. Further properties (brand, manufacturer,
model, MPN, GTIN, color, material, weight, dimensions, description) are read from attributes chosen per property,
with a fallback attribute and then the attribute with the code of the property. The settings save the code of the
attribute, so they can be locked in
app/etc/config.phpfor all installations of a shop. Numeric dimensions get the unit of the setting "Dimension Unit".
Prices are the final prices in the currency of the store, with or without tax like in the catalog. Configurable and grouped products get the lowest price of their variants or products; with "Aggregate Offer" they get the lowest and the highest price with an offer per variant or product, bundle products the lowest and highest price of their selections.
On the product page, the main image is also added to the microdata of the Luma theme (itemprop="image"), whose
gallery is built by JavaScript.
Meta tags
-
Open Graph: type, title, description, URL and image (the logo) of category, CMS and other pages, and the name of the store. Magento adds the Open Graph tags of product pages itself; their description falls back to the meta description of the page for products without short description.
-
Facebook: the app ID.
-
Twitter Card: card type, the account of the shop, title, description and image (of the product on product pages, else the logo).
-
Canonical links for the home page (the base URL of the store) and for CMS pages.
-
Product meta title and description from templates, for products without their own:
{{code}}stands for the value of the attribute with this code (the labels of options, several options joined with commas), text in square brackets is left out if one of its placeholders has no value. Sections can be nested. For example:{{name}} – Original Painting[, {{width}} x {{height}} cm] | My Shop "{{name}}" by {{manufacturer}}[: {{technique}}[ on {{support}}]]. A unique piece. -
Titles and descriptions: the page title, the meta title and the meta description are shortened to a maximum length, at the end of a word. The heading of the page stays complete.
AI visibility
With Infrangible AI Visibility, products without description get
the text of the template "Product Meta Description" as description in llms.txt, llms-full.txt and their Markdown
versions.
Sitemap
With Infrangible Sitemap, the URLs of products, categories and CMS pages get a PageMap with the title and, for products, the rating in half stars.
Configuration
Stores > Configuration > Infrangible Solutions > Search Engine Optimizations:
- Page: maximum lengths of title and description (70 and 150 characters by default, empty or 0 for no limit), canonical links for the home page and CMS pages, the templates of the product meta title and description (empty by default: Magento's meta title and description).
- Rich Snippets: Website (on by default) with Search Action, Organization with its properties, Product (on by default) with Aggregate Offer, Aggregate Rating (optionally on a scale of 0 to 100), Reviews and a Yes/No, an attribute and a fallback attribute per further property, and the unit of the dimensions.
- Open Graph, Facebook, Twitter Card, Sitemap: off by default.
Requirements
- Magento Open Source or Adobe Commerce 2.4.6 or newer
- PHP 8.1 or newer
- The Luma theme or a theme based on it
Installation
composer require infrangible/m2-catalog-seo bin/magento module:enable Infrangible_CatalogSeo bin/magento setup:upgrade bin/magento cache:flush
In production mode, also run bin/magento setup:di:compile and bin/magento setup:static-content:deploy.
License
Infrangible Catalog SEO is licensed under the MIT License - see the LICENSE file for details.