Skip to content

Commit

Permalink
Merge pull request #585 from Yoast/release/10.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
RinyVT authored Jan 27, 2025
2 parents 66d1fa9 + f5b323e commit b29550d
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
publish:
name: Publish new version to TER
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v2
Expand All @@ -20,7 +20,7 @@ jobs:
fi
- name: Set up PHP Version
run: |
sudo update-alternatives --set php /usr/bin/php7.4
sudo update-alternatives --set php /usr/bin/php8.0
php -v
- name: Update Composer
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
54 changes: 54 additions & 0 deletions Classes/StructuredData/TypoScriptStructuredDataProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?php

declare(strict_types=1);

namespace YoastSeoForTypo3\YoastSeo\StructuredData;

use TYPO3\CMS\Core\Domain\Repository\PageRepository;
use TYPO3\CMS\Core\Site\SiteFinder;
use TYPO3\CMS\Core\TypoScript\TypoScriptService;
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;

class TypoScriptStructuredDataProvider implements StructuredDataProviderInterface
{
public function __construct(
protected SiteFinder $siteFinder,
protected PageRepository $pageRepository,
protected TypoScriptService $typoScriptService,
) {}

/**
* @return array<array<string, mixed>>
*/
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((string)$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'];
}
}
File renamed without changes.
5 changes: 5 additions & 0 deletions Configuration/TypoScript/Setup/Config.typoscript
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ config {
site {
provider = YoastSeoForTypo3\YoastSeo\StructuredData\SiteStructuredDataProvider
}

typoscript {
provider = YoastSeoForTypo3\YoastSeo\StructuredData\TypoScriptStructuredDataProvider
after = breadcrumb
}
}
pageTitleProviders {
yoastRecord {
Expand Down
5 changes: 1 addition & 4 deletions Documentation/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://typo3.slack.com/archives/C14EQDFL1>`__. If you
want support for your installation, you can buy our
`premium plugin <https://yoast.com/typo3-extensions-seo/>`__ and get 24/7
support.
`#yoast-seo-for-typo3 <https://typo3.slack.com/archives/C14EQDFL1>`__.

.. note::

Expand Down

0 comments on commit b29550d

Please sign in to comment.