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

feat(routing): external redirects #12979

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

Conversation

ematipico
Copy link
Member

@ematipico ematipico commented Jan 13, 2025

Changes

Closes PLT-2745

This PR adds support for external directs in the redirects configuration:

  • Added a new error in case the user specify a URL that doesn't start with http:// or https:// or the URL isn't parsable
  • No special handling for patterns. Astro can't know if the external an Astro site, so it's virtually impossible to handle route patterns e.g. [...slug], [slug]
  • No particular handling inside underscore-redirects (apart from tiny refactors)

Testing

Added new tests

Docs

withastro/docs#10704

/cc @withastro/maintainers-docs for feedback!

Copy link

changeset-bot bot commented Jan 13, 2025

🦋 Changeset detected

Latest commit: 7038546

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

@ematipico ematipico force-pushed the feat/external-redirercts branch from 69681fb to a0e7716 Compare January 13, 2025 15:38
@ematipico ematipico force-pushed the feat/external-redirercts branch from a0e7716 to e0d2234 Compare January 13, 2025 15:39
@github-actions github-actions bot added pkg: astro Related to the core `astro` package (scope) docs pr labels Jan 13, 2025
Copy link

codspeed-hq bot commented Jan 13, 2025

CodSpeed Performance Report

Merging #12979 will not alter performance

Comparing feat/external-redirercts (7038546) with main (1a026af)

Summary

✅ 6 untouched benchmarks

@github-actions github-actions bot added the semver: minor Change triggers a `minor` release label Jan 14, 2025
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is blocked because it contains a minor changeset. A reviewer will merge this at the next release if approved.

@ematipico ematipico marked this pull request as ready for review January 14, 2025 11:18
Copy link
Member

@florian-lefebvre florian-lefebvre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! This requires no changes at the adapter level right?

.changeset/light-pants-smoke.md Outdated Show resolved Hide resolved
packages/astro/src/core/redirects/render.ts Outdated Show resolved Hide resolved
ematipico and others added 2 commits January 14, 2025 13:22
Co-authored-by: Florian Lefebvre <contact@florian-lefebvre.dev>
@ematipico
Copy link
Member Author

LGTM! This requires no changes at the adapter level right?

It shouldn't

Copy link
Member

@sarah11918 sarah11918 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great @ematipico ! Just a suggestion of what you could do in case you wanted to add a little hype to the changeset. Choose whatever kind of wording you want, but I think 2 sentences works nice here: one to link to redirects for reference, and one to explicitly say "provide a URL" to introduce the code sample.

.changeset/light-pants-smoke.md Outdated Show resolved Hide resolved
Co-authored-by: Sarah Rainsberger <5098874+sarah11918@users.noreply.github.com>
@florian-lefebvre
Copy link
Member

florian-lefebvre commented Jan 15, 2025

@ematipico the build is failing, I think that's because of this deletion 6a03c29 (#12979)

@sarah11918
Copy link
Member

Ah, probably the end syntax here?
image

Co-authored-by: Sarah Rainsberger <5098874+sarah11918@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs pr pkg: astro Related to the core `astro` package (scope) semver: minor Change triggers a `minor` release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants