Skip to content
This repository was archived by the owner on Feb 16, 2026. It is now read-only.

Commit 7ccd925

Browse files
committed
Generate and use .ico favicon for Bing search results
1 parent 5635a6d commit 7ccd925

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

resources/views/snippets/_browser_appearance.antlers.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
{{ if browser_appearance:use_favicons }}
2525
{{# SVG of any size, main icon #}}
2626
<link rel="icon" href="{{ browser_appearance:svg }}" type="image/svg+xml">
27+
<link rel="icon" href="/favicons/{{ site:handle }}/favicon.ico" type="image/x-icon">
2728

2829
{{# Safari fallback icon #}}
2930
{{ if browser_appearance:safari_icon }}

src/Generators/Favicons.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,17 @@ public static function generate(): void
2828
$svg = $set->value('svg');
2929
$background = $set->value('background');
3030

31-
self::createThumbnail($svg, $site->handle() . '/icon-180.png', 180, 180, $background, 15);
32-
self::createThumbnail($svg, $site->handle() . '/icon-512.png', 512, 512, $background, 15);
33-
self::createThumbnail($svg, $site->handle() . '/favicon-16x16.png', 16, 16, 'transparent', false);
34-
self::createThumbnail($svg, $site->handle() . '/favicon-32x32.png', 32, 32, 'transparent', false);
31+
self::createThumbnail($svg, $site->handle() . '/icon-180.png', 'png32', 180, 180, $background, 15);
32+
self::createThumbnail($svg, $site->handle() . '/icon-512.png', 'png32', 512, 512, $background, 15);
33+
self::createThumbnail($svg, $site->handle() . '/favicon-16x16.png', 'png32', 16, 16, 'transparent', false);
34+
self::createThumbnail($svg, $site->handle() . '/favicon-32x32.png', 'png32', 32, 32, 'transparent', false);
35+
self::createThumbnail($svg, $site->handle() . '/favicon.ico', 'ico', 32, 32, 'transparent', false);
3536
});
3637

3738
Artisan::call('cache:clear');
3839
}
3940

40-
protected static function createThumbnail($import, $export, $width, $height, $background, $border): void
41+
protected static function createThumbnail($import, $export, $format, $width, $height, $background, $border): void
4142
{
4243
$svg = Storage::disk('favicons')->get($import);
4344
$svgObj = simplexml_load_string($svg);
@@ -71,7 +72,7 @@ protected static function createThumbnail($import, $export, $width, $height, $ba
7172
$img->resizeImage($width, $height, \Imagick::FILTER_LANCZOS, 1);
7273
}
7374

74-
$img->setImageFormat('png32');
75+
$img->setImageFormat($format);
7576
Storage::disk('favicons')->put($export, $img->getImageBlob());
7677
$img->clear();
7778
$img->destroy();

0 commit comments

Comments
 (0)