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

Redirects #3311

Closed
matthewp opened this issue May 22, 2023 · 5 comments · Fixed by #3395
Closed

Redirects #3311

matthewp opened this issue May 22, 2023 · 5 comments · Fixed by #3395
Labels
add new content Document something that is not in docs. May require testing, confirmation, or affect other pages. merge-on-release Don't merge this before the feature is released! (MQ=approved but WAIT for feature release!) minor-release For the next minor release; in the milestone, "merge queue" when approved by Sarah!

Comments

@matthewp
Copy link
Contributor

matthewp commented May 22, 2023

Needs

  • API reference docs
  • ? - This feature is most useful in SSG, so maybe it should go there? This feature does work in SSR as well, but you can already do redirects in SSR (manually) so it's not adding a new capability, just making one easier.

How it works

You can add a top-level redirects config with keys that are from routes and the values are the to route. For example:

import { defineConfig } from 'astro/config';

export default defineConfig({
  redirects: {
    '/api': '/docs/api'
  }
})
@sarah11918 sarah11918 added merge-on-release Don't merge this before the feature is released! (MQ=approved but WAIT for feature release!) add new content Document something that is not in docs. May require testing, confirmation, or affect other pages. labels May 25, 2023
@matthewp
Copy link
Contributor Author

API reference is being reviewed in the current PR. Is there an additional place we should document this feature?

@sarah11918
Copy link
Member

Just making a quick note that in addition to docs for redirects explaining how to use them, we'll need to update:

  • api-reference for Astro.redirect() which currently describes it as an SSR-only feature
  • the SSR page which has an example of Astro.redirect() as an SSR feature (e.g. redirecting after logging in) - this is not incorrect usage, but it's listed here as an SSR feature which is now not correct.

Also, I think the best place for this content for now at least is on the Routing page. Since this is mostly an SSG feature (and we don't have an SSG page) but also can be used in SSR, and since it relates to (re)routing, that's my suggestion for where this content can go!

@matthewp
Copy link
Contributor Author

matthewp commented Jun 1, 2023

@sarah11918 Are you saying we should remove the Astro.redirect section from the server-side-rendering page?

@sarah11918
Copy link
Member

Yes, if it's no longer exclusively an SSR feature, which the RFC seemed to say. I think this can go with the new redirects content on the routing page.

@matthewp
Copy link
Contributor Author

matthewp commented Jun 1, 2023

PR: #3395

@sarah11918 sarah11918 added the minor-release For the next minor release; in the milestone, "merge queue" when approved by Sarah! label Jun 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
add new content Document something that is not in docs. May require testing, confirmation, or affect other pages. merge-on-release Don't merge this before the feature is released! (MQ=approved but WAIT for feature release!) minor-release For the next minor release; in the milestone, "merge queue" when approved by Sarah!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants