Redirects for static builds #319
Replies: 4 comments 7 replies
-
Interesting idea! We use this technique on the Astro docs site just by having some pages that only contain the appropriate I think this could also be a good candidate for an integration. Integrations can access an export default defineConfig({
integrations: [
redirect({
'/foo/bar': '/unicorn/rainbow',
}),
],
}); |
Beta Was this translation helpful? Give feedback.
-
another usecase for a redirect builder like this would be to make implementing https://www.defined.net/blog/internationalizing-docs-pages-with-astro/ easier! |
Beta Was this translation helpful? Give feedback.
-
I think this is a good idea. My only question would be whether this should be done as an integration or built-in some how. Do any other frameworks have this sort of feature? Next.js, Gatsby, Eleventy, etc? |
Beta Was this translation helpful? Give feedback.
-
This proposal has been advanced to Stage 2 of our RFC process. |
Beta Was this translation helpful? Give feedback.
-
It would be useful if Astro could support redirects for static builds (non-SSR).
I generate a static build for my website and host it on GitHub Pages. Sometimes I want to rename a route or refactor how I organize pages. I cannot just rename a page as there may be links pointing to it.
It would be useful if I could declare redirects in the Astro config:
Astro would then use this trick to generate the boilerplate redirect files as needed.
Note that it's important that the boilerplate also contains some JS to properly forward query parameters and URL fragment.
This is possible with Jekyll: https://github.com/jekyll/jekyll-redirect-from
Beta Was this translation helpful? Give feedback.
All reactions