Closed mschmitz89 closed 1 year ago
Hi,
you could use the same events as the cs_seo, to modify the URLs.
Here are the registered listener in Configuration/Services.yaml.
Clickstorm\CsSeo\EventListener\CanonicalListener:
tags:
- name: event.listener
identifier: 'cs-seo/canonical'
event: TYPO3\CMS\Seo\Event\ModifyUrlForCanonicalTagEvent
Clickstorm\CsSeo\EventListener\HrefLangListener:
tags:
- name: event.listener
identifier: 'cs_seo/CsSeoHrefLang'
after: 'typo3-seo/hreflangGenerator'
event: TYPO3\CMS\Frontend\Event\ModifyHrefLangTagsEvent
Then in your service you can check:
$metaDataService = GeneralUtility::makeInstance(MetaDataService::class);
$metaData = $metaDataService->getMetaData();
if(is_array($metaData) && empty($metaData['canonical']) && empty($metaData['no_index']) {
... do your own stuff
}
Hello all,
I have an installation where the same news could be output on different list pages and detail pages, because the news has e.g. several categories, which each have their own output page again. Therefore I would like to set the canonical URL of the news always to the default news detail page to reduce duplicate content.
Is this somehow possible?
Currently I just disable the canonical URL generation for news detail pages and reset the canonical URL myself, but with this the function to set the canonical URL for news manually is not working anymore, so now I am looking for a better solution.