Yoast / Yoast-SEO-for-Magento2

Yoast SEO for Magento 2
Other
70 stars 28 forks source link

[Feature Request] URL Suffix setting in Canonical Tag #102

Open kartguru opened 5 years ago

kartguru commented 5 years ago

Just noticed a few duplicate content issues because I have set the URL Suffix to not have a trailing slash and I believe Yoast SEO is adding a trailing slash and confusing Google.

A setting to define the Product URL Suffix and Category URL Suffix or using the Magento Admin option would be helpful.

Cheers

jamieparkes commented 5 years ago

As a temporary fix to this i removed:

public function getCanonicalUrl()
{
    $canonical = $this->getUrl('', [
        '_current' => true,
        '_use_rewrite' => true
    ]);
    if ($canonical
        && substr($canonical, -5) !== '.html'
        && substr($canonical, -1) !== '/') {
        $canonical .= '/';
    }

    return $canonical;
}

from /vendor/maxserv/magento-module-yoastseo/Block/YoastSeo.php

and continued to use Magento 2's built in canonical settings.