Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom 404 page injected using injectRoute not used #6937

Closed
1 task done
delucis opened this issue Apr 28, 2023 · 0 comments · Fixed by #6940
Closed
1 task done

Custom 404 page injected using injectRoute not used #6937

delucis opened this issue Apr 28, 2023 · 0 comments · Fixed by #6940
Labels
- P3: minor bug An edge case that only affects very specific usage (priority)

Comments

@delucis
Copy link
Member

delucis commented Apr 28, 2023

What version of astro are you using?

2.3.2

Are you using an SSR adapter? If so, which one?

None

What package manager are you using?

npm/pnpm

What operating system are you using?

macOS / Stackblitz

What browser are you using?

Firefox

Describe the Bug

When a project includes src/pages/404.astro, this route gets used as a custom 404 page, including in dev.

However, if an integration uses the injectRoute hook to inject a custom page at /404, Astro does not treat this the same way: the injected page is only available at /404, other 404 errors continue to show the standard Astro 404 screen during dev. (The injected route does get correctly built as 404.html though, so should work in production on static hosts that support that pattern like Netlify.)

I’d expect injecting a route to /404 to allow an integration to set the 404 users see during dev.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-3u16qb?file=astro.config.mjs

Participation

  • I am willing to submit a pull request for this issue.
@delucis delucis added - P3: minor bug An edge case that only affects very specific usage (priority) routing labels Apr 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P3: minor bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant