Serve /favicon.ico instead of a 404 - #14
Open
cfboy wants to merge 1 commit into
Open
Conversation
Crawlers and older browsers request /favicon.ico by path convention before reading the icon tags in <head>, and that path returned 404. Nothing was broken by it — the SVG tag is well formed, robots.txt blocks nothing, and Google reads SVG favicons — but the fallback every other client reaches for first was missing. Generated from favicon.svg so the vector stays the source of truth: rasterized to 256px, then one frame per size at 16/32/48 (48 is what Google asks for, 16/32 keep browser tabs crisp). Only the alpha channel is resampled. Resizing the RGBA image directly makes Pillow premultiply, and undoing that leaves the antialiased rim lighter than the fill — measured up to (255,169,169) against a flat #f99898, a visible pale halo on a mark this small. Building each frame from flat brand colour plus a resampled alpha keeps every visible pixel exactly #f99898, and cut the file from 4600 to 2649 bytes as a side effect. The .ico is declared first and without a type so anything that understands SVG still picks the vector.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to the SERP check:
/favicon.icoreturned 404 on production.Nothing was actually broken — the
<link rel="icon">tag is well formed,robots.txtblocks nothing, and Google reads SVG favicons. But
/favicon.icois the pathcrawlers and older browsers request by convention before parsing
<head>, so itis worth not being a 404.
To be clear about scope: this will not refresh the icon Google is currently
showing. That one is a cached copy of the pre-
930c45alogo (still has the "titi"text above the A). Googlebot-Favicon runs on its own schedule, measured in weeks,
and there is no way to force it. This change is housekeeping, not a fix for that.
How it was generated
The vector stays the source of truth.
favicon.svg→ rasterized to 256px withsips→ one frame per size at 16/32/48 (48 is what Google asks for; 16/32 keepbrowser tabs crisp).
The part worth reviewing
Only the alpha channel is resampled. Resizing the RGBA image directly makes
Pillow premultiply — provably, since fully transparent pixels I had set to
(249,152,152,0)came back as(0,0,0,0)— and undoing that premultiplicationleaves the antialiased rim lighter than the fill:
(248,151,151)→(255,169,169)(249,152,152)On a mark this small that drift reads as a pale halo. Building each frame from flat
brand colour plus a resampled alpha fixes it, and cut the file from 4600 to 2649
bytes as a side effect.
Verification
#f99898at all three sizestype=1, 3 frames, 32bpp, sane offsetsdist/favicon.icobyte-identical topublic/favicon.ico; served200 image/x-iconclip the A's legs, which is the constraint documented in
favicon.svg🤖 Generated with Claude Code