Skip to content

Commit

Permalink
Remove TYPO3 page metatags and canonical URL from catalog list and de…
Browse files Browse the repository at this point in the history
…tail pages
  • Loading branch information
aimeos committed Jan 29, 2020
1 parent 27cf113 commit d3b4c5f
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
24 changes: 24 additions & 0 deletions Classes/Controller/CatalogController.php
Expand Up @@ -12,6 +12,7 @@


use Aimeos\Aimeos\Base;
use TYPO3\CMS\Core\Utility\GeneralUtility;


/**
Expand All @@ -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 );
}
Expand Down Expand Up @@ -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 );
}
Expand Down Expand Up @@ -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' );
}
}
}
9 changes: 8 additions & 1 deletion ext_localconf.php
Expand Up @@ -293,7 +293,7 @@


/**
* Add Typo3 Hooks
* Add TYPO3 Hooks
*/

if( !isset( $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['felogin']['logout_confirmed']['aimeos'] ) ) {
Expand All @@ -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'] );

?>

0 comments on commit d3b4c5f

Please sign in to comment.