1
0
Fork 0
mirror of https://github.com/archtechx/laravel-seo.git synced 2025-12-12 09:54:03 +00:00

Add previewify prefix (#24)

* add required previewify prefix

* Fix code style (php-cs-fixer)

* only add prefix when not already available

* Fix code style (php-cs-fixer)

Co-authored-by: PHP CS Fixer <phpcsfixer@example.com>
This commit is contained in:
Tobias Petry 2022-07-05 20:19:46 +02:00 committed by GitHub
parent cf8ec8d3ae
commit a737879baf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 7 deletions

View file

@ -192,9 +192,14 @@ class SEOManager
if ($data === null) {
$data = [
'title' => $this->raw('title'),
'description' => $this->raw('description'),
'previewify:title' => $this->raw('title'),
'previewify:description' => $this->raw('description'),
];
} else {
$data = array_combine(
array_map(fn ($key) => str_starts_with($key, 'previewify:') ? $key : "previewify:{$key}", array_keys($data)),
$data,
);
}
$query = base64_encode(json_encode($data, JSON_THROW_ON_ERROR));