From 64256b97c37ad30c7d186adced812d603e0c6cd3 Mon Sep 17 00:00:00 2001
From: Georgi Mateev <gmateev@exactag.com>
Date: Thu, 28 Oct 2021 05:47:56 +0300
Subject: [PATCH] [BUGFIX] Fix canonical links and deprecate the
 MetaTagGenerator fields

---
 Classes/Controller/NewsByAuthorController.php | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/Classes/Controller/NewsByAuthorController.php b/Classes/Controller/NewsByAuthorController.php
index 7a5f550..53435c6 100644
--- a/Classes/Controller/NewsByAuthorController.php
+++ b/Classes/Controller/NewsByAuthorController.php
@@ -67,8 +67,11 @@ class NewsByAuthorController extends AbstractController {
 
 			$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();
+			if (version_compare(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getExtensionVersion('sg_seo'),
+							'5.0.0', '<')) {
+				$GLOBALS['TSFE']->page['extensionArgumentsForCanonicalAndHrefLang'] =
+					'&tx_sgnews_newsbyauthor[authorId]=' . $author->getUid();
+			}
 
 			$authors[] = $author;
 		}
-- 
GitLab