diff --git a/Classes/Controller/CatalogController.php b/Classes/Controller/CatalogController.php index 35d119e5..57d8ec40 100644 --- a/Classes/Controller/CatalogController.php +++ b/Classes/Controller/CatalogController.php @@ -12,6 +12,7 @@ use Aimeos\Aimeos\Base; +use TYPO3\CMS\Core\Utility\GeneralUtility; /** @@ -36,6 +37,7 @@ public function attributeAction() */ public function detailAction() { + $this->removeMetatags(); $client = \Aimeos\Client\Html::create( $this->getContext(), 'catalog/detail' ); return $this->getClientOutput( $client ); } @@ -66,6 +68,7 @@ public function countAction() */ public function listAction() { + $this->removeMetatags(); $client = \Aimeos\Client\Html::create( $this->getContext(), 'catalog/lists' ); return $this->getClientOutput( $client ); } @@ -129,4 +132,25 @@ public function treeAction() $client = \Aimeos\Client\Html::create( $this->getContext(), 'catalog/tree' ); return $this->getClientOutput( $client ); } + + + /** + * Removes the meta tags if available + */ + protected function removeMetatags() + { + if( class_exists( '\TYPO3\CMS\Core\MetaTag\MetaTagManagerRegistry' ) ) + { + $registry = GeneralUtility::makeInstance( 'TYPO3\CMS\Core\MetaTag\MetaTagManagerRegistry' ); + + $registry->getManagerForProperty( 'keywords' )->removeProperty( 'keywords' ); + $registry->getManagerForProperty( 'description' )->removeProperty( 'description' ); + $registry->getManagerForProperty( 'og:type' )->removeProperty( 'og:type' ); + $registry->getManagerForProperty( 'og:title' )->removeProperty( 'og:title' ); + $registry->getManagerForProperty( 'og:url' )->removeProperty( 'og:url' ); + $registry->getManagerForProperty( 'og:description' )->removeProperty( 'og:description' ); + $registry->getManagerForProperty( 'og:image' )->removeProperty( 'og:image' ); + $registry->getManagerForProperty( 'twitter:card' )->removeProperty( 'twitter:card' ); + } + } } diff --git a/ext_localconf.php b/ext_localconf.php index 111ffe72..6c55ea2d 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -293,7 +293,7 @@ /** - * Add Typo3 Hooks + * Add TYPO3 Hooks */ if( !isset( $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['felogin']['logout_confirmed']['aimeos'] ) ) { @@ -306,4 +306,11 @@ }; } + +/** + * Disable TYPO3 canonical tags so Aimeos ones are used + */ + +unset( $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['TYPO3\CMS\Frontend\Page\PageGenerator']['generateMetaTags']['canonical'] ); + ?>