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

fix(rewrite): allow to rewrite 404 and take base into consideration #11272

Merged
merged 5 commits into from
Jun 19, 2024

Conversation

ematipico
Copy link
Member

Changes

Closes #11235

This PR fixes few bugs and reverts some changes:

  • It's now possible to rewrite 404 (again). I believe it makes sense to rewrite /404 even in SSG
  • There were few bugs when calculating the URL to rewrite when trailingSlash is "never" and the user uses Astro.rewrite("/")
  • I refactored the logic of tryRewrite and moved inside a generic function, since there was shared logic

Testing

I created new test cases with custom 404.astro and default 404.
I created new test cases with trailingSlash: "never"

Docs

N/A

Copy link

changeset-bot bot commented Jun 17, 2024

🦋 Changeset detected

Latest commit: f501042

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added pkg: astro Related to the core `astro` package (scope) pr: docs A PR that includes documentation for review labels Jun 17, 2024
@ematipico ematipico force-pushed the fix/rewriting-bugs branch from 7b79492 to 9bfcecf Compare June 17, 2024 11:21
@ematipico ematipico requested a review from matthewp June 19, 2024 12:17
@ematipico ematipico merged commit ea987d7 into main Jun 19, 2024
14 checks passed
@ematipico ematipico deleted the fix/rewriting-bugs branch June 19, 2024 13:25
@astrobot-houston astrobot-houston mentioned this pull request Jun 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope) pr: docs A PR that includes documentation for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rewriting to the root doesn't work with trailingSlash: never & rewrite to non-existed page/404 issues
4 participants