Skip to content

Personalised, known3xx.astro page #1170

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

Open
ematipico opened this issue May 19, 2025 · 7 comments
Open

Personalised, known3xx.astro page #1170

ematipico opened this issue May 19, 2025 · 7 comments

Comments

@ematipico
Copy link
Member

Summary

Allow to have a known file called 3xx.astro that allows to return a personalised version of a redirect page

Background & Motivation

Since we introduced i18n routing, there have been cases where this new features uses the redirect engine used by Astro.

This showed some shortcomings in features:

  • it's not possible to personalise the markup of the page
  • it's not possible to change the delay of the redirect, which makes a difference in SSG, where a short delay is marked as a temporary redirect, while a long delay is a permanent redirect
  • i18n routing users can't translate the page

Goals

  • similar to 404.astro, to have a 3xx.astro file that will serve any 3 hundred status code
  • users can use any markup inside the page
  • fallback to the built-in redirect layout if nothing is provided
@github-project-automation github-project-automation bot moved this to Stage 2: Accepted Proposals, No RFC in Public Roadmap May 19, 2025
@florian-lefebvre
Copy link
Member

I think a potential issue is that this change may be breaking. Eg. what if a user already has a page named this? Or want to use it not for redirects? It's not the same with 404.astro

@ematipico
Copy link
Member Author

ematipico commented May 19, 2025

I think a potential issue is that this change may be breaking. Eg. what if a user already has a page named this? Or want to use it not for redirects? It's not the same with 404.astro

It was the same for middleware.js and actions.js, and we haven't shipped them with a major release.

@florian-lefebvre
Copy link
Member

I think it's a bit different here because it ends up in the url eg /3xx. Not saying that requires a major, but there's possibility of conflict. it's perfectly valid for a user to want to call a route /3xx without configuring the redirect page IMO

@ematipico
Copy link
Member Author

ematipico commented May 19, 2025

Yes, and while the feature is under experimental, it's not a problem. If you're really concerned about having many bug reports, we can enable this feature via configuration. I am not concerned.

@ascorbic
Copy link
Contributor

Not really the same, because middleware.js and actions.js aren't in /pages/

@ascorbic
Copy link
Contributor

But I agree – I don't think this requires a major

@Eveeifyeve
Copy link

Eveeifyeve commented May 19, 2025

I feel like it should be named redirects or at least use the statuscode because there is two type of redirects a permanent and temporary redirects. there is actually more types of redirects. Or at least provide an api for status codes so users can even customize the messages based on statuscodes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Stage 2: Accepted Proposals, No RFC
Development

No branches or pull requests

4 participants