Product import
This commit is contained in:
1 parent
7442d10e68
commit
7833e1b668
21 files changed
+763
-185
No files matched your search
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Evomedien\Vitec\Seo;
|
||||
|
||||
use FriendsOfTYPO3\Headless\Seo\MetaHandler;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
|
||||
/**
|
||||
* Mirrors the real page <title> into `meta.title` of the page JSON.
|
||||
*
|
||||
* Why: `meta.title` is rendered from TypoScript (lib.meta) BEFORE the page
|
||||
* content, so on product/usecase detail pages it still shows the generic
|
||||
* page title ("Product") - the record's seotitle only reaches the
|
||||
* PageTitleProvider while the content renders. Headless fixes `seo.title`
|
||||
* afterwards through this handler; we extend it so `meta.title` gets the
|
||||
* same final value. Registered via the MetaHandlerInterface alias in
|
||||
* Services.yaml, which covers both the cacheable listener and the
|
||||
* USER_INT middleware path.
|
||||
*/
|
||||
class VitecMetaHandler extends MetaHandler
|
||||
{
|
||||
public function process(ServerRequestInterface $request, array $content): array
|
||||
{
|
||||
$content = parent::process($request, $content);
|
||||
|
||||
$title = trim((string)($content['seo']['title'] ?? ''));
|
||||
if ($title !== '' && is_array($content['meta'] ?? null)) {
|
||||
$content['meta']['title'] = $title;
|
||||
}
|
||||
|
||||
return $content;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user