Skip to content

fix(gallery): link the favicon the app already serves - #1375

Merged
vivek7405 merged 1 commit into
mainfrom
fix/gallery-favicon-link
Aug 10, 2026
Merged

fix(gallery): link the favicon the app already serves#1375
vivek7405 merged 1 commit into
mainfrom
fix/gallery-favicon-link

Conversation

@vivek7405

Copy link
Copy Markdown
Collaborator

gallery.webjs.dev renders with a blank tab mark.

gallery/app/icon.ts has been answering /icon with a real SVG the whole time (verified live: 200, image/svg+xml, 287 bytes). But a metadata route is not auto-linked. The framework emits <link rel="icon"> only from metadata.icons (packages/server/src/ssr.js:1840), and gallery/app/layout.ts declared only title and description. So the head named no icon, the browser fell back to /favicon.ico, and the gallery ships no such file.

Check on the live site Before
GET /icon 200, image/svg+xml
<link rel="icon"> in the served HTML none
GET /favicon.ico (browser fallback) 404

The scaffold's generated layout declares metadata.icons correctly (packages/cli/lib/create.js:1205). gallery/app/layout.ts is one of the four app-shell files excluded from the template copy, so it never picked the key up. That matters more than a missing icon: the gallery is the canonical reference for what a scaffolded app looks like, and it was demonstrating a favicon route that does not work.

Tests

Each half stayed green on its own, so all three assertions ship together in gallery/test/seo/favicon.test.ts:

  1. the home page head declares a <link rel="icon"> pointing at /icon
  2. /icon answers 200 with an image/* content type
  3. every icon href in the head resolves rather than 404s, which is the failure mode itself

Counterfactual: with the icons key reverted, 1 and 3 fail and 2 still passes.

webjs check and webjs typecheck are clean in gallery/.

Out of scope

The gallery's head also carries a duplicate <meta charset> and <title> (the layout hand-writes both and the framework splices its own from metadata). Harmless, left alone.

app/icon.ts answered /icon with a real SVG, but a metadata ROUTE is not
auto-linked: the framework emits <link rel="icon"> only from
metadata.icons. The gallery's root layout declared just a title and a
description, so the head named no icon, the browser fell back to
/favicon.ico, and the gallery ships no such file. gallery.webjs.dev
rendered with a blank tab mark.

The scaffold's generated layout gets this right, so the gallery was
teaching a favicon route that does not work in the one app meant to be
read as reference.

Cover it where each half alone stayed green: the head must declare an
icon, /icon must serve an image, and every icon href in the head must
resolve rather than 404.
@vivek7405
vivek7405 merged commit 12f1f14 into main Aug 10, 2026
8 of 10 checks passed
@vivek7405
vivek7405 deleted the fix/gallery-favicon-link branch August 10, 2026 14:54
vivek7405 added a commit that referenced this pull request Aug 10, 2026
…1377)

#1375 fixed the blank tab by linking /icon, but that route is the
metadata-route DEMO: it generates a placeholder grey "w", so the gallery
rendered as a different product beside webjs.dev in a tab strip.

Ship the website's committed brand assets in gallery/public/ and declare
them through metadata.icons in the same shape and order the website uses,
raster ahead of SVG for Google's favicon crawler. favicon.ico rides along
unlinked; the framework serves it at the origin root for crawlers that
read no markup, and it 404'd before.

app/icon.ts stays as the dynamic-favicon demo, which is what it always
was: the scaffold copies it into generated apps and gallery:clear prunes
it with the other metadata routes. Its comment now says the gallery's own
mark is the static one, so the route is not mistaken for live wiring.

Move the test to the repo suite. It reads website/public/, which exists
only here, and gallery/test/** is scaffold payload that copyGallery()
copies into every generated app, where a stray directory also left
gallery:clear unable to prune an empty test/ (red on main since #1375).
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