mirror of
https://github.com/archtechx/laravel-seo.git
synced 2025-12-12 01:44:03 +00:00
only add prefix when not already available
This commit is contained in:
parent
5c2fa1753a
commit
96c20f3bf6
2 changed files with 6 additions and 6 deletions
|
|
@ -196,11 +196,11 @@ class SEOManager
|
|||
'previewify:description' => $this->raw('description'),
|
||||
];
|
||||
} else {
|
||||
$data = array_combine(
|
||||
array_map(fn ($key) => "previewify:{$key}", array_keys($data)),
|
||||
$data,
|
||||
);
|
||||
}
|
||||
$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));
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ test('previewify makes a request to the template not the alias', function () {
|
|||
|
||||
test('previewify templates can be given data', function () {
|
||||
seo()->previewify('blog', 1);
|
||||
expect(seo()->previewify('blog', ['title' => 'abc', 'excerpt' => 'def']))
|
||||
expect(seo()->previewify('blog', ['title' => 'abc', 'previewify:excerpt' => 'def']))
|
||||
->toContain('previewify.app/generate/templates/1')
|
||||
->toContain(base64_encode(json_encode(['previewify:title' => 'abc', 'previewify:excerpt' => 'def'])));
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue