Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX] Use websiteTitle of site configuration for snippet preview #564

Merged
merged 1 commit into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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