/** * {@inheritdoc} */ protected function doEnhance(CustomUrlBehavior $customUrl, Webspace $webspace, array $defaults, Request $request) { $seo = ['noFollow' => $customUrl->isNoFollow(), 'noIndex' => $customUrl->isNoIndex()]; if ($customUrl->isCanonical()) { $resourceSegment = $customUrl->getTargetDocument()->getResourceSegment(); $seo['canonicalUrl'] = $this->webspaceManager->findUrlByResourceLocator($resourceSegment, $defaults['_environment'], $customUrl->getTargetLocale(), $webspace->getKey()); } return ['_seo' => $seo]; }