Canonical Custom Page
Composer kowal/module-canonical-custom-page · Version 1.0.2
Product page
Canonical Custom Page — kowal.co
Description
Sets the canonical URL for a CMS page and maps other storefront paths to their preferred URLs.
For whom
For store administrators and SEO teams choosing the preferred URL for CMS content and custom storefront routes.
Features
- Set the canonical address on an individual CMS page.
- Map custom request paths to preferred destinations.
- Use a store-relative path or a complete HTTPS address as the target.
Installation
From the Magento root, with Composer access to the Kowal package, run
composer require kowal/module-canonical-custom-page
bin/magento module:enable Kowal_CanonicalCustomPage
bin/magento setup:upgrade
bin/magento cache:clean
Configuration
Edit a CMS page, expand Search Engine Optimization and fill in Canonical URL. Enter an absolute HTTPS URL or a store-relative path. For non-CMS pages use Custom page canonicals under Canonical Custom Page → Settings. Enter one mapping per line, such as seasonal-offer | offers. Path matching ignores the query string. The module is enabled by default.
Requirements / notes
A canonical link is metadata in the page head. A customer can still visit the original address. Inspect the HTML source when checking a mapping.
FAQ
Where do I set the canonical URL for the CMS home page?
Use the Canonical URL field on the CMS page assigned as the home page. The custom path mapping handles non-CMS requests.
Verify the installation
Save the page, refresh the cache and inspect the href of the link rel="canonical" element in the HTML source. For a relative target, also check that the resulting domain belongs to the intended store view.