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

Implement support for dynamic routes in redirects #7173

Merged
merged 3 commits into from
May 23, 2023

Conversation

matthewp
Copy link
Contributor

Changes

  • Adds support for dynamic routes. Syntax is:
redirects: {
  '/blog/[...slug]': '/team/articles/[...slug]'
}

Same as for file-based router. This does not introduce any new syntax.

Testing

  • Base test case added in core
  • Netlify tested and implemented.

Docs

Not yet, docs will be done as a separate issue.

@matthewp matthewp requested a review from a team as a code owner May 23, 2023 12:14
@changeset-bot
Copy link

changeset-bot bot commented May 23, 2023

⚠️ No Changeset found

Latest commit: d0f7e12

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

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

@github-actions github-actions bot added pkg: astro Related to the core `astro` package (scope) pkg: integration Related to any renderer integration (scope) labels May 23, 2023
@matthewp matthewp force-pushed the redirects-ssg-dynamic branch from 245917d to f3c55a0 Compare May 23, 2023 12:22
packages/astro/src/core/build/static-build.ts Outdated Show resolved Hide resolved
@matthewp matthewp merged commit 25d7d20 into redirects-ssg May 23, 2023
@matthewp matthewp deleted the redirects-ssg-dynamic branch May 23, 2023 13:01
matthewp added a commit that referenced this pull request Jun 5, 2023
* Redirects spike

* Allow redirects in static mode

* Support in Netlify as well

* Adding a changeset

* Rename file

* Fix build problem

* Refactor to be more modular

* Fix location ref

* Late test should only run in SSR

* Support redirects in Netlify SSR configuration (#7167)

* Implement support for dynamic routes in redirects (#7173)

* Implement support for dynamic routes in redirects

* Remove the .only

* No need to special-case redirects in static build

* Implement support for redirects config in the Vercel adapter (#7182)

* Implement support for redirects config in the Vercel adapter

* Remove unused condition

* Move to a internal helper package

* Add support for the object notation in redirects

* Use status 308 for non-GET redirects (#7186)

* Implement redirects in Cloudflare (#7198)

* Implement redirects in Cloudflare

* Fix build

* Update tests b/c of new ordering

* Debug issue

* Use posix.join

* Update packages/underscore-redirects/package.json

Co-authored-by: Emanuele Stoppa <[email protected]>

* Update based on review comments

* Update broken test

---------

Co-authored-by: Emanuele Stoppa <[email protected]>

* Test that redirects can come from middleware (#7213)

* Test that redirects can come from middleware

* Allow non-promise returns for middleware

* Implement priority (#7210)

* Refactor

* Fix netlify test ordering

* Fix ordering again

* Redirects: Allow preventing the output of the static HTML file (#7245)

* Do a simple push for priority

* Adding changesets

* Put the implementation behind a flag.

* Self review

* Update .changeset/chatty-actors-stare.md

Co-authored-by: Chris Swithinbank <[email protected]>

* Update packages/astro/src/@types/astro.ts

Co-authored-by: Chris Swithinbank <[email protected]>

* Update packages/astro/src/@types/astro.ts

Co-authored-by: Chris Swithinbank <[email protected]>

* Update packages/astro/src/@types/astro.ts

Co-authored-by: Chris Swithinbank <[email protected]>

* Update packages/astro/src/@types/astro.ts

Co-authored-by: Chris Swithinbank <[email protected]>

* Update docs on dynamic restrictions.

* Update packages/astro/src/@types/astro.ts

Co-authored-by: Sarah Rainsberger <[email protected]>

* Update packages/astro/src/@types/astro.ts

Co-authored-by: Sarah Rainsberger <[email protected]>

* Code review changes

* Document netlify static adapter

* Update packages/astro/src/@types/astro.ts

Co-authored-by: Sarah Rainsberger <[email protected]>

* Slight reword

* Update .changeset/twenty-suns-vanish.md

Co-authored-by: Sarah Rainsberger <[email protected]>

* Add a note about public/_redirects file

* Update packages/astro/src/@types/astro.ts

Co-authored-by: Sarah Rainsberger <[email protected]>

---------

Co-authored-by: Emanuele Stoppa <[email protected]>
Co-authored-by: Chris Swithinbank <[email protected]>
Co-authored-by: Sarah Rainsberger <[email protected]>
Co-authored-by: Nate Moore <[email protected]>
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) pkg: integration Related to any renderer integration (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants