mirror of
https://github.com/archtechx/laravel-seo.git
synced 2025-12-12 09:54: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
|
|
@ -197,7 +197,7 @@ class SEOManager
|
||||||
];
|
];
|
||||||
} else {
|
} else {
|
||||||
$data = array_combine(
|
$data = array_combine(
|
||||||
array_map(fn ($key) => "previewify:{$key}", array_keys($data)),
|
array_map(fn ($key) => str_starts_with($key, 'previewify:') ? $key : "previewify:{$key}", array_keys($data)),
|
||||||
$data,
|
$data,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ test('previewify makes a request to the template not the alias', function () {
|
||||||
|
|
||||||
test('previewify templates can be given data', function () {
|
test('previewify templates can be given data', function () {
|
||||||
seo()->previewify('blog', 1);
|
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('previewify.app/generate/templates/1')
|
||||||
->toContain(base64_encode(json_encode(['previewify:title' => 'abc', 'previewify:excerpt' => 'def'])));
|
->toContain(base64_encode(json_encode(['previewify:title' => 'abc', 'previewify:excerpt' => 'def'])));
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue