Skip to content

Rank PNG, WebP and AVIF sources above favicon.ico - #2

Merged
markvaneijk merged 1 commit into
mainfrom
rank-larger-raster-first
Sep 28, 2026
Merged

markvaneijk merged 1 commit into
mainfrom
rank-larger-raster-first

Conversation

@markvaneijk

Copy link
Copy Markdown
Contributor

Problem

Candidate sources are ranked by format first; declared size only breaks ties within a format. With ico at priority 1 and png at 2, a site's /favicon.ico always won — even over a declared 512×512 PNG. Since a favicon.ico rarely holds more than 64px, every larger variant (180, 192, 512) ended up upscaled. Seen on artsenverklaringen.nl, whose .ico tops out at 64px next to a 512px PNG.

Change

  • config/favicon.php: png/webp/avif now rank 1 and ico ranks 2 (svg stays first, jpg/gif unchanged). Declared PNGs then sort largest-first; a site offering only an .ico still uses it, and the /favicon.ico fallback stays last.
  • README: describe the new preference order.
  • Test: a page declaring favicon.ico (sizes="any") plus 32px and 512px PNGs resolves to the 512px PNG. Fails on the old defaults, passes now; full suite green (33 tests).

Apps that published the config keep their own source_priority and need the same edit.

🤖 Generated with Claude Code

Format outranked declared size, so a site's favicon.ico (rarely larger
than 64px) beat its 512px PNG and every larger variant was upscaled.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@markvaneijk
markvaneijk merged commit e70fd91 into main Sep 28, 2026
8 checks passed
@markvaneijk
markvaneijk deleted the rank-larger-raster-first branch September 28, 2026 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant