Canonical Url for Magento 2

Canonical Url for M2

Introduction

The extension help avoid duplicate content in Google's index and make your site more crawlable.

Installation

The extension has 2 separate ways of installation, via Composer or by copying the code.

Please follow this Installation Guide to install the extension.

Extension Configuration

Before Getting Started

please, first disable the default Magento canonical before enable the extension. Go to Configuration -> Catalog -> Catalog -> Search Engine Optimization section:

  • Set Use Canonical Link Meta Tag for Categories -  to "No"
  • Set Use Canonical Link Meta Tag for Products -  to "No"

Configuration

To access the Canonical Url settings, log into the Magento Admin panel and go to STORES ⟶ Configuration ⟶ ULMOD EXTENSIONS ⟶ SEO Canonical Url.

General

Enable Extension -  if ‘Yes’, the canonical meta tag will be added in the section of any page.

Exclude Canonical Meta Tag On These Pages -  enter the pages to exclude or ignore canonical meta tag. One page per line. Example:

  • To exclude canonical meta tag on product pages use : 'catalog_product_view'
  • To exclude canonical meta tag on CMS Pages (All) page use : 'cms_page_view'
  • To exclude canonical meta tag on CMS home page use : 'cms_index_index'
  • To exclude canonical meta tag on category pages use: 'catalog_category_view

Trailing Slash For Canonical Meta Tag -  "Add" or "Crop" trailing slash to the canonical url. Trailing slash will be added or cropped to the pages without suffix .html or .htm

Canonical Meta Tag For Store Url (Cross Domain) -  Choose the main domain from other domains that have similar content. The canonical tag will be added on the main domain. This feature is usefull for store with multiple domains and similar content per domain within a single Magento installation

Canonical Meta Tag For Custom Url (crooss domain) -  specify the custom URL for the domain to add the canonical meta tag..

Categories

Add Canonical Meta Tag To The Layered Navigation Pages? -  choose to add canonical meta tag to the layered navigation pages for filtered page or current category page

Add Canonical Meta Tag To The Pagination Pages? -  set to "Yes" to add the canonical meta tag to the pages ending with : ?p=1, ?p=2, ?p=3, ?p=4, ?p=5 etc.

Add rel="next" and rel="prev" To The Category Page -  set "Yes", to use the rel=next/prev tag to inform Google, about the 1st and the last pages, next or previous page. .

Products

note: before using this feature, please make sure to first set this Stores > Settings > Configuration > Catalog > Search Engine Optimizations > "Use Categories Path for Product URLs" field to Yes

Product Canonical URL Type -  choose the canonical url type to use for products pages:

  • If Without Categories Path -  is selected, the no categories path will be added to the product url. Eg. "mysite.com/product.html"
  • If Use Shortest Categories Path -  is selected, the product url will use the shortest categories path. Eg. "mysite.com/category1/sub-category1/sub-category2/product.html"
  • If Use Longest Categories Path -  is selected, the product url will use the longest categories path. Eg. "mysite.com/category1/sub-category1/sub-category2/sub-category3/product.html"

Individual Settings

The extension allows overriding the canonical URL per individual/single category, product, and CMS page. You can set a custom canonical URL per product, category, and CMS pages.

Categories

to override the canonical url per single/individual category page, please go to CATALOG ⟶ Catalog ⟶ Categories, select the page and go to the "Search Engine Optimization" tab. Then, set "Override Existing Canonical URL" to "Yes" and enter the "Custom Canonical URL"



Products

to override the canonical url per single/individual product page, please go to CATALOG ⟶ Catalog ⟶ Products, select the page and go to the "Search Engine Optimization" tab. Then, set "Override Existing Canonical URL" to "Yes" and enter the "Custom Canonical URL"

to set cross-domain canonical URL per single/individual product, please go to CATALOG ⟶ Catalog ⟶ Products, select the page and go to the "Search Engine Optimization" tab. Choose the Cross Domain Store per product or define the Custom Domain URL to add the canonical URL



CMS Pages

to override the canonical url per single/individual page page, please go to CONTENT ⟶ Content ⟶ Pages, select the page and go to the "Search Engine Optimization" tab. Then, set "Override Existing Canonical URL" to "Yes" and enter the "Custom Canonical URL"



Canonical URL Per Product Attribute

To set the Canonical URL per product attribute, for pages filtered by layered navigation: 

  • Go to STORES -> Product -> Attribute, select the attribute, and go to "Storefront Properties" tab
  • In the Canonical Tag for Pages Filtered by Layered Navigation Leads to field, choose from Use Config, Filtered page or Current Category option per attribute. The Use Config option is the setting available on the “Add canonical meta tag to the layered navigation ?” field , under the Stores > Configuration > Ulmod Extensions > SEO Canonical Url -> Categories settings

Extension Support

Need Help?

Ulmod Support team is always ready to assist you, no matter which part of the world you are in. If something does happen and you think you might be experiencing an issue or bug, please contact us via [email protected] or submit a ticket from our Helpdesk Ticket and we will help you out.

Got Questions?

Should you have any questions or feature suggestions, please Contact Us. Your feedback is welcome!

Extension Product Page