Skip to content
Snippets Groups Projects
Commit 8909e048 authored by Georgi Mateev's avatar Georgi Mateev
Browse files

[BUGFIX] Fix head tags: title, description, canonical and hreflang

parent 02edbb07
No related branches found
No related tags found
No related merge requests found
......@@ -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();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment