-
Notifications
You must be signed in to change notification settings - Fork 57
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
Comments
I think |
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)." |
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. |
We might be able to accomplish this with middleware: https://nextjs.org/docs/app/building-your-application/routing/middleware#advanced-middleware-flags |
Middleware is not supported for static builds: https://nextjs.org/docs/pages/building-your-application/deploying/static-exports |
Just realized there is technically a solution, not sure it's worth it. The Change this https://github.com/ruffle-rs/ruffle-rs.github.io/blob/master/src/app/not-found.tsx: "use client";
import classes from "./not-found.module.css";
import { Stack, Text, Title } from "@mantine/core";
import React, { useEffect } from "react";
export default function Home() {
useEffect(() => {
if (document.location.pathname === "/blog/") {
document.location.href = "/blog";
}
}, []);
return (
<Stack align="center">
<Title className={classes.title}>404</Title>
<Title order={2}>Page not found :(</Title>
<Text>The requested page could not be found.</Text>
</Stack>
);
} |
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 withoutput: "export"
enabled in nextConfig. I tried creating anindex.tsx
file in theblog
folder, using exportPathMap, and using a redirects() function, but none of these seem to work with our setup. Most people say to just addtrailingSlash: true
to the nextConfig, but I'm not sure if that would break other previously-working URLs on the site.The text was updated successfully, but these errors were encountered: