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

Blog link with trailing slash is broken https://ruffle.rs/blog/ #210

Open
n0samu opened this issue Jan 20, 2024 · 5 comments
Open

Blog link with trailing slash is broken https://ruffle.rs/blog/ #210

n0samu opened this issue Jan 20, 2024 · 5 comments

Comments

@n0samu
Copy link
Member

n0samu commented Jan 20, 2024

https://ruffle.rs/blog/ was the main page of the blog in the previous version of the site, but now it's a 404 page. I couldn't find a way to create an index.html redirect with output: "export" enabled in nextConfig. I tried creating an index.tsx file in the blog folder, using exportPathMap, and using a redirects() function, but none of these seem to work with our setup. Most people say to just add trailingSlash: true to the nextConfig, but I'm not sure if that would break other previously-working URLs on the site.

@danielhjacobs
Copy link
Collaborator

I think trailingSlash: true would mostly be fine, but the issue is it would break https://ruffle.rs/avm2.html. It would also break https://ruffle.rs/downloads.html etc, but I'm not so worried about those pages as they didn't previously exist. Unfortunately, https://ruffle.rs/avm2.html did exist.

@danielhjacobs
Copy link
Collaborator

https:/ruffle-rs/ruffle-rs.github.io/blob/master/src/app/avm2/page.tsx is what allows https://ruffle.rs/avm2.html to redirect, but according to https://nextjs.org/docs/app/api-reference/next-config-js/trailingSlash, "When used with output: "export" configuration, the /about page will output /about/index.html (instead of the default /about.html)."

@danielhjacobs
Copy link
Collaborator

Though that page also says "By default Next.js will redirect urls with trailing slashes to their counterpart without a trailing slash." Not sure why that is not happening.

@danielhjacobs
Copy link
Collaborator

We might be able to accomplish this with middleware: https://nextjs.org/docs/app/building-your-application/routing/middleware#advanced-middleware-flags

@n0samu
Copy link
Member Author

n0samu commented Mar 19, 2024

Middleware is not supported for static builds: https://nextjs.org/docs/pages/building-your-application/deploying/static-exports
As long as we're using GitHub Pages I don't think there is any solution to this issue. Just wanted to log it for posterity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants