diff --git a/Classes/Controller/NewsByAuthorController.php b/Classes/Controller/NewsByAuthorController.php index 3f280ad0570717db956679b4a35ada72764fa0f2..4ace64d3cd03019ceb74e63fe1c9a6e1e63a5abd 100644 --- a/Classes/Controller/NewsByAuthorController.php +++ b/Classes/Controller/NewsByAuthorController.php @@ -32,6 +32,7 @@ use SGalinski\SgNews\Domain\Model\News; use SGalinski\SgNews\Domain\Repository\AuthorRepository; use SGalinski\SgNews\Domain\Repository\CategoryRepository; use SGalinski\SgNews\Domain\Repository\NewsRepository; +use SGalinski\SgSeo\Service\HeadTagService; use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; use TYPO3\CMS\Core\Utility\GeneralUtility; @@ -67,12 +68,18 @@ class NewsByAuthorController extends AbstractController { continue; } - $GLOBALS['TSFE']->page['titlebyextension'] = $author->getName(); - $GLOBALS['TSFE']->page['description'] = \strip_tags(\substr($author->getDescription(), 0, 200)); - - if (version_compare( - ExtensionManagementUtility::getExtensionVersion('sg_seo'), - '5.0.0', '<')) { + if (version_compare(ExtensionManagementUtility::getExtensionVersion('sg_seo'), '5.0.0', '>=')) { + $headTagService = GeneralUtility::makeInstance( + HeadTagService::class, + TRUE, + $author->getName(), + $author->getDescription(), + '&tx_sgnews_newsbyauthor[authorId]=' . $author->getUid() + ); + $headTagService->execute(); + } else { + $GLOBALS['TSFE']->page['titlebyextension'] = $author->getName(); + $GLOBALS['TSFE']->page['description'] = \strip_tags(\substr($author->getDescription(), 0, 200)); $GLOBALS['TSFE']->page['extensionArgumentsForCanonicalAndHrefLang'] = '&tx_sgnews_newsbyauthor[authorId]=' . $author->getUid(); }