Skip to content

Commit

Permalink
Merge pull request #564 from Yoast/bugfix/549-website-title
Browse files Browse the repository at this point in the history
[BUGFIX] Use websiteTitle of site configuration for snippet preview
  • Loading branch information
RinyVT authored Nov 21, 2023
2 parents b23fb5c + aee76b6 commit 77b5100
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions Classes/Frontend/AdditionalPreviewData.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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']);
Expand Down

0 comments on commit 77b5100

Please sign in to comment.