SeoCanonical
https://github.com/magesuite/seo-canonical
This extension adds an extra setting to output canonical link meta tags for category and product pages. Canonical URLs prevent duplication of content and increase SEO.
Â
Installation
This module is part of MageSuite metapackage
Â
Installation if metapackage is not used:
composer require "creativestyle/magesuite-seo-canonical" ^1.0.0
Admin settings
Admin settings can be found under Stores -> Configuration -> MageSuite -> SEO
tab.
Â
Â
Settings:
Name | Value | Comment |
---|---|---|
Canonical Tag For Other Pages |  Yes/No | Enables canonical tag for pages which Magento doesn't support out of the box like CMS ones. Read more. |
Â
Backend
Backend documentation in progress
Â
Given url is formatted and set in <link> element on page
vendor/creativestyle/magesuite-seo-canonical/view/frontend/templates/canonical.phtml
<?php
$canonicalUrl = $block->getCanonicalUrl();
if ($canonicalUrl):
?>
<link rel="canonical" href="<?= $canonicalUrl; ?>">
<?php
endif;
Â
vendor/creativestyle/magesuite-seo-canonical/Block/Canonical.php:25
class Canonical extends \Magento\Framework\View\Element\Template
{
protected $_template = 'MageSuite_SeoCanonical::canonical.phtml';
.....
public function getCanonicalUrl()
{
return $this->canonicalUrl->getCanonicalUrl();
}
}
Â
vendor/creativestyle/magesuite-seo-canonical/Service/CanonicalUrl.php:33
Â
Â
Frontend
Frontend template for canonical URLs is located under Creativestyle_SeoCanonicalExtension::canonical.phtml
It uses getCanonicalUrl()
in order to display a canonical url.
Â
Â