infrangible / m2-cms-block-meta-data
Adds meta title, meta keywords and meta description fields to CMS blocks and applies them to the page on which the block is shown as a widget.
Package info
github.com/infrangible-dev/m2-cms-block-meta-data
Type:magento2-module
pkg:composer/infrangible/m2-cms-block-meta-data
Requires
- php: >=8.1
- fewedev/base: ~2.4.3
- infrangible/m2-foundation: ~3.0.2
- magento/framework: ~103.0.6
- magento/module-cms: ~104.0.6
- magento/module-store: ~101.1.6
- magento/module-theme: ~101.1.6
Requires (Dev)
- infrangible/phpstan-magento: ~1.2.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-12-01 14:51:33 UTC
README
Adds meta title, meta keywords and meta description fields to CMS blocks and applies them to the page on which the block is shown with the widget "CMS Static Block".
Behavior
Magento keeps meta data for CMS pages, products and categories, but not for CMS blocks. If a page is built from a block, for example a landing page that only shows a block through a widget, its title and meta tags could not be maintained in the block.
- The CMS block form (Content > Elements > Blocks) gets the section "Search Engine Optimization" with the fields "Meta Title", "Meta Keywords" and "Meta Description".
- When a page shows an active block with the widget "CMS Static Block", the filled fields of the block replace the title, meta keywords and meta description of the page. Empty fields keep the values of the page. The visible heading of the page stays as it is.
- This works for widgets in the content of CMS pages (inserted with "Insert Widget") and for widget instances (Content > Elements > Widgets) on any page.
- Blocks are loaded like the widget loads them: by ID or identifier, for the current store view, only if active.
- If a page shows several blocks with meta data, the values of the last one win.
- Blocks inside other blocks, blocks placed by the theme layout and blocks in category descriptions are not taken into account.
Requirements
- Magento Open Source or Adobe Commerce 2.4.6 or newer
- PHP 8.1 or newer
Installation
composer require infrangible/m2-cms-block-meta-data bin/magento module:enable Infrangible_CmsBlockMetaData bin/magento setup:upgrade
In production mode, also run bin/magento setup:di:compile.
The fields are the columns meta_title, meta_keywords and meta_description of the table cms_block.
License
Infrangible CMS Block Meta Data is licensed under the MIT License - see the LICENSE file for details.