Skip to content

By default settings Magento 2 allows developers to set canonical URL for category and product pages, not for CMS pages to solve duplicate content issues upfront. With this simple tweak, you can do the same for CMS pages either keeping trailing slash intact at the end of URL or removing it.

License

Notifications You must be signed in to change notification settings

darshit21/Mconnectmedia_CmsPageCanonicalUrl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 

Repository files navigation

Canonical URL for CMS Page - Magento 2 Website

With the default, Magento set up developer enable to add canonical URL on Product and category page directly using admin panel. Unfortunately, it is not so in the case of CMS pages.

Therefore, M-Connect Media have developed a simple code function to add canonical URL on CMS pages as well. Thus, we can eliminate duplicate content pages issues throughout the Magento 2 website with simple tweaks.

Using the same, it automatically adds canonical URL, as a display in the head. Moreover, it provides two options in bonus, and those are as following:

  1. It lets you keep trailing slash at the end of the URL
  2. It lets you remove trailing slash at the end of the URL

Setup

Please download Mconnectmedia_CmsPageCanonicalUrl.Zip from given URL. Now, unzip it, and upload in Magento root directory. After that run below Command.

Run Command List

php bin/magento module:enable Mconnectmedia_CmsPageCanonicalUrl
php bin/magento setup:upgrade
php bin/magento cache:flush
php bin/magento cache:clean
rm -rf var/di var/generation var/cache

Back-end Options

You can access its setting through Admin panel. Easy to use and manage!

Admin Setting

Canonical URL without Trailing Slash

Canonical URL with Trailing Slash

About

By default settings Magento 2 allows developers to set canonical URL for category and product pages, not for CMS pages to solve duplicate content issues upfront. With this simple tweak, you can do the same for CMS pages either keeping trailing slash intact at the end of URL or removing it.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages