ethercreative / seo

SEO utilities including a unique field type, sitemap & redirect manager
MIT License
269 stars 96 forks source link

[FR] No way to disable the canonical header #423

Open baronvertigovongrahamthesecondofsealand opened 2 years ago

baronvertigovongrahamthesecondofsealand commented 2 years ago

Description

There is no configuration to disable the canonical header. Sometimes there is a need to do so, without keeping an edited and unmaintained version of the plugin.

In SeoService.php:

public function injectCanonical ()
{
    list($field) = $this->_getElementAndSeoFields();

    Craft::$app->getResponse()->getHeaders()->add(
        'Link',
        '<' . $field->canonical . '>; rel="canonical"'
    );
}

This needs a configurable switch to toggle injection.

Additional info