diff --git a/resources/views/components/extensions/favicon.blade.php b/resources/views/components/extensions/favicon.blade.php
index bafadca..01e850b 100644
--- a/resources/views/components/extensions/favicon.blade.php
+++ b/resources/views/components/extensions/favicon.blade.php
@@ -1,2 +1,6 @@
-
-
+@if ($favicon = seo('favicon'))
+
+@else
+
+
+@endif
diff --git a/src/SEOManager.php b/src/SEOManager.php
index 9e5b9ad..c93cc29 100644
--- a/src/SEOManager.php
+++ b/src/SEOManager.php
@@ -216,9 +216,13 @@ public function previewify(string $alias, int|string|array $data = null): string
}
/** Enable favicon extension. */
- public function favicon(): static
+ public function favicon(string|bool $value = true): static
{
- $this->extensions['favicon'] = true;
+ if (is_string($value) && !empty($value)) {
+ $this->set('favicon', $value);
+ }
+
+ $this->extensions['favicon'] = !!$value;
return $this;
}
diff --git a/tests/Pest/FaviconTest.php b/tests/Pest/FaviconTest.php
index 2c9ca40..98e23e2 100644
--- a/tests/Pest/FaviconTest.php
+++ b/tests/Pest/FaviconTest.php
@@ -41,3 +41,28 @@
assertFileDoesNotExist(public_path('favicon.ico'));
assertFileDoesNotExist(public_path('favicon.png'));
});
+
+test('it should have custom value with non-empty string', function () {
+ seo()->favicon('foo');
+
+ expect(seo('favicon'))->toBe('foo');
+ expect(meta())->toContain('');
+});
+
+test('it should not have custom value with empty string or false', function () {
+ seo()->favicon('');
+
+ expect(seo('favicon'))->toBe(null);
+ expect(meta())->not()->toContain('link rel="icon"');
+
+ expect(seo('favicon'))->toBe(null);
+ expect(meta())->not()->toContain('link rel="icon"');
+});
+
+test('it should have default favicon setup', function () {
+ seo()->favicon();
+ expect(seo('favicon'))->toBe(null);
+
+ expect(meta())->toContain('');
+ expect(meta())->toContain('');
+});
\ No newline at end of file