ruffle-rs.github.io icon indicating copy to clipboard operation
ruffle-rs.github.io copied to clipboard

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

Open n0samu opened this issue 1 year ago • 6 comments

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.

n0samu avatar Jan 20 '24 08:01 n0samu

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 avatar Feb 09 '24 14:02 danielhjacobs

https://github.com/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 avatar Feb 09 '24 14:02 danielhjacobs

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 avatar Feb 09 '24 14:02 danielhjacobs

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

danielhjacobs avatar Feb 09 '24 14:02 danielhjacobs

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.

n0samu avatar Mar 19 '24 22:03 n0samu