diff --git a/src/SEOManager.php b/src/SEOManager.php index 5c329ca..34d1d62 100644 --- a/src/SEOManager.php +++ b/src/SEOManager.php @@ -153,6 +153,8 @@ class SEOManager $signature = hash_hmac('sha256', $template . $query, config('services.flipp.key')); + $template = $this->meta("flipp.templates.$template"); + return $this->set('image', "https://s.useflipp.com/{$template}.png?s={$signature}&v={$query}"); } diff --git a/tests/Pest/FlippTest.php b/tests/Pest/FlippTest.php index bb5c0f9..6392ac5 100644 --- a/tests/Pest/FlippTest.php +++ b/tests/Pest/FlippTest.php @@ -10,10 +10,16 @@ test('flipp templates can be set', function () { ->toHaveKey('blog', 'abcdefg'); }); +test('flipp makes a request to the template not the alias', function () { + seo()->flipp('blog', 'abcdefg'); + expect(seo()->flipp('blog')) + ->toContain('s.useflipp.com/abcdefg'); +}); + test('flipp templates can be given data', function () { seo()->flipp('blog', 'abcdefg'); expect(seo()->flipp('blog', ['title' => 'abc', 'excerpt' => 'def'])) - ->toContain('s.useflipp.com/blog') + ->toContain('s.useflipp.com/abcdefg') ->toContain(base64_encode(json_encode(['title' => 'abc', 'excerpt' => 'def']))); }); @@ -30,7 +36,7 @@ test("flipp templates use default data when they're not passed any data explicit seo()->title('foo')->description('bar'); expect(seo()->flipp('blog')) - ->toContain('s.useflipp.com/blog') + ->toContain('s.useflipp.com/abcdefg') ->toContain(base64_encode(json_encode(['title' => 'foo', 'description' => 'bar']))); });