Magento Image ALT Text from Product Attributes Module
- Compatibility
- 2.4.8, 2.4.7, 2.4.6, 2.4.5, 2.4.4, 2.4.3, 2.4.2, 2.4.1, 2.4.0, 2.3.7, 2.3.6, 2.3.5, 2.3.4
Description / Magento Image ALT Text from Product Attributes Module
Automatic ALT Text Based on Product Data
Use information already stored in the Magento catalog to create alternative text for images. Kowal Image Alt From Attributes generates ALT text according to the selected structure, eliminating the need to prepare each text manually.
Images can provide an additional source of organic traffic, complementing other SEO efforts. The previous description cited a figure indicating that nearly 38% of pages in Google search results contained images and predicted that this share would increase. This information has been retained from the previous description; it is not a currently verified statistic or a forecast of store performance.
How ALT Text Is Generated
In the configuration, you select a structure using the available placeholders. The module retrieves product data and combines its values into text associated with the image. Example structure: {product_name} {product_sku} {product_color}.
- Product name, SKU, and final price.
- Category names and parent category.
- Size, color, and manufacturer when the corresponding attributes are available and populated.
- Support for data included in the code, such as material, pattern, style, theme, and new and sale labels, depending on the catalog structure.
ALT Text for CMS Pages as Well
A separate structure for CMS images can use the {page_title} and {content_heading}placeholders. Custom text can be set for a page and takes precedence over the general structure. The module adds ALT text to images in CMS content that already have an empty alt.
Configuration and Use
In Stores → Configuration → Customers → Image Alt From Attributes, enable the module and define ALT structures for products and CMS pages. Settings are available at the Default, Website, and Store View levels.
The solution helps maintain consistent image descriptions across an extensive catalog. Text quality depends on the completeness of product data and the selection of placeholders. The module generates ALT text when images are displayed and does not require manually saving a label for each image.
Installation
Composer package: kowal/module-imagealtfromattributes; module: Kowal_ImageAltFromAttributes. Once the package is available in the Composer repository, install it, enable the module, run the Magento upgrade, and clear the cache. Then configure the structure and verify the results on product images and CMS pages.
More Information
| Theme compatibility | Luma / Blank, KOWAL |
|---|
Module Installation Instructions
Installation
* In a production environment, please use the option --keep-generated
Type: Composer
-
The module is available in the Composer repository:
- Private GitLab repository:
https://gitlab.com
- Private GitLab repository:
-
Add the Composer repository to your configuration:
composer config repositories.image.alt.from.attributes vcs https://gitlab.com/magento2ext/magento-2-image-alt-from-attributes -
Add the access token for the private GitLab repository:
composer config --auth gitlab-token.gitlab.com <TWÓJ_TOKEN> -
Install the module using Composer:
composer require kowal/module-imagealtfromattributes -
Apply the database updates:
php bin/magento setup:upgrade -
Clear the cache:
php bin/magento cache:flush