Skip to content

Error pages link a root-absolute favicon, which 404s on a sub-path site #235

Description

@mmcky

On a site served under a base URL, an error page's icon link still points at the domain root and 404s there. Normal pages are fine as of #227, which emits the favicon from the local Document where BASE_URL is available — but error pages do not render through that component.

What I verified in this repository:

Fact Where
The root ErrorBoundary is upstream's component, re-exported as-is app/root.tsx:27export { AppErrorBoundary as ErrorBoundary } from '@myst-theme/site'
The root route's links() supplies a root-absolute icon app/root.tsx{ rel: 'icon', href: '/favicon.ico' }
That links() is deliberately where error-page head links live the comment beside it: root's links() are the only ones that also apply when the root ErrorBoundary renders
links() cannot be made base-aware it takes no arguments in Remix 1.17, and BASE_URL reaches the app only through the root loader

So the root-absolute href is not an oversight in links() — it is the only thing links() can express, and the base-aware version can only come from a component that receives BASE_URL. Upstream's AppErrorBoundary renders upstream's own Document, which this theme does not pass a base URL to.

I have not inspected the upstream package's internals to confirm how its Document builds head links; the conclusion above rests on this repository's own code and comments. Anyone picking this up should start there.

Scope

Only affects sites served under a sub-path (BASE_URL set) — which is the deployed lecture-wasm shape, and the PR-preview shape. A root-hosted site is unaffected, since the root-absolute path is already correct there. The visible symptom is a missing tab icon on 404 and error pages, so it is cosmetic rather than functional.

Possible directions

  1. Wrap or replace the root ErrorBoundary with a local component that renders the theme's own Document, so the base-aware head links apply to error pages too. Keeps the fix in this repository.
  2. Raise it upstream, so AppErrorBoundary's document can take a base URL. Wider benefit, but outside this repository's control.

Raised while reviewing #227, whose author flagged it as out of scope for that PR and correct to leave — the acceptance criterion there was only that error pages declare an icon link, which they do.

🤖 Generated with Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is wrong or broken in a lecture or build

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions