diff --git a/CHANGELOG.md b/CHANGELOG.md index 852731f9..af623d42 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,16 @@ This changelog is according to [Keep a Changelog](http://keepachangelog.com). All notable changes to this project will be documented in this file. We will follow [Semantic Versioning](http://semver.org/). +## UNRELEASED +### Added +- `TypoScriptStructuredDataProvider` to add structured data to the page, configured with TypoScript (premium functionality) + +### Fixed +- Renamed `JavascriptModules.php` to `JavaScriptModules.php` + +### Changed +- Removed the premium support mention within the documentation + ## 10.0.0 October 15, 2024 ### Breaking - Dropped support for TYPO3 10 diff --git a/Classes/StructuredData/TypoScriptStructuredDataProvider.php b/Classes/StructuredData/TypoScriptStructuredDataProvider.php new file mode 100644 index 00000000..7dc13a8b --- /dev/null +++ b/Classes/StructuredData/TypoScriptStructuredDataProvider.php @@ -0,0 +1,54 @@ +> + */ + public function getData(): array + { + $data = []; + + foreach ( + $this->getTyposcriptFrontendController()->config['config']['structuredData.']['data.'] ?? [] as $dataConfig + ) { + if (array_key_exists('type', $dataConfig) && array_key_exists('context', $dataConfig)) { + $item = []; + $config = $this->typoScriptService->convertTypoScriptArrayToPlainArray($dataConfig); + + foreach ($config as $key => $value) { + $cObject = $key . '.'; + if (isset($dataConfig[$cObject])) { + $value = $this->getTyposcriptFrontendController()->cObj->stdWrap($key, $dataConfig[$cObject]); + } + $key = in_array($key, ['type', 'context']) ? '@' . $key : $key; + + $item[$key] = $value; + } + $data[] = $item; + } + } + + return (array)$data; + } + + protected function getTyposcriptFrontendController(): TypoScriptFrontendController + { + return $GLOBALS['TSFE']; + } +} diff --git a/Configuration/JavascriptModules.php b/Configuration/JavaScriptModules.php similarity index 100% rename from Configuration/JavascriptModules.php rename to Configuration/JavaScriptModules.php diff --git a/Configuration/TypoScript/Setup/Config.typoscript b/Configuration/TypoScript/Setup/Config.typoscript index 6be0fc2f..f52d2f51 100644 --- a/Configuration/TypoScript/Setup/Config.typoscript +++ b/Configuration/TypoScript/Setup/Config.typoscript @@ -10,6 +10,11 @@ config { site { provider = YoastSeoForTypo3\YoastSeo\StructuredData\SiteStructuredDataProvider } + + typoscript { + provider = YoastSeoForTypo3\YoastSeo\StructuredData\TypoScriptStructuredDataProvider + after = breadcrumb + } } pageTitleProviders { yoastRecord { diff --git a/Documentation/Index.rst b/Documentation/Index.rst index 324a335f..2154f0e1 100644 --- a/Documentation/Index.rst +++ b/Documentation/Index.rst @@ -59,10 +59,7 @@ and help editors write high quality content. .. tip:: Community support is available in the TYPO3 Slack channel - `#yoast-seo-for-typo3 `__. If you - want support for your installation, you can buy our - `premium plugin `__ and get 24/7 - support. + `#yoast-seo-for-typo3 `__. .. note::