From aee76b65966e35ec095dde5fdeaa3de092381f1b Mon Sep 17 00:00:00 2001 From: Riny van Tiggelen Date: Wed, 8 Nov 2023 15:24:17 +0100 Subject: [PATCH] [BUGFIX] Use websiteTitle of site configuration for snippet preview --- CHANGELOG.md | 1 + Classes/Frontend/AdditionalPreviewData.php | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 43836931..f527e281 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ We will follow [Semantic Versioning](http://semver.org/). ### Fixed - Missing label of the tx_yoastseo_prominent_word table - Removed exclude=true from tx_yoastseo_prominent_word fields, table already has hideTable +- Use `websiteTitle` of site configuration within snippet preview, previously this was only taken from site languages instead of the site itself ### Changed - Updated mentions of the premium extension within the documentation diff --git a/Classes/Frontend/AdditionalPreviewData.php b/Classes/Frontend/AdditionalPreviewData.php index e756ec43..56c021ec 100644 --- a/Classes/Frontend/AdditionalPreviewData.php +++ b/Classes/Frontend/AdditionalPreviewData.php @@ -5,6 +5,7 @@ namespace YoastSeoForTypo3\YoastSeo\Frontend; use TYPO3\CMS\Core\SingletonInterface; +use TYPO3\CMS\Core\Site\Entity\Site; use TYPO3\CMS\Core\Site\Entity\SiteLanguage; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer; @@ -38,6 +39,10 @@ protected function getWebsiteTitle(): string if ($language instanceof SiteLanguage && !empty($language->getWebsiteTitle())) { return trim($language->getWebsiteTitle()); } + $site = $request->getAttribute('site'); + if ($site instanceof Site && !empty($site->getConfiguration()['websiteTitle'] ?? '')) { + return trim($site->getConfiguration()['websiteTitle']); + } if (!empty($GLOBALS['TSFE']->tmpl->setup['sitetitle'] ?? '')) { return trim($GLOBALS['TSFE']->tmpl->setup['sitetitle']);