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

set custom favicon value & render

This commit is contained in:
Phuong Vu 2024-02-21 22:35:38 +07:00
parent 6d6903ad62
commit d46433c10e
2 changed files with 12 additions and 4 deletions

View file

@ -1,2 +1,6 @@
<link rel="icon" type="image/x-icon" href="{{ asset('favicon.ico') }}">
<link rel="icon" type="image/png" href="{{ asset('favicon.png') }}">
@if ($favicon = seo('favicon'))
<link rel="icon" href="{{ $favicon }}">
@else
<link rel="icon" type="image/x-icon" href="{{ asset('favicon.ico') }}">
<link rel="icon" type="image/png" href="{{ asset('favicon.png') }}">
@endif

View file

@ -216,9 +216,13 @@ class SEOManager
}
/** 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;
}