Skip to content

Instantly share code, notes, and snippets.

@cyberfly
Last active July 25, 2022 07:23
Show Gist options
  • Save cyberfly/3f01e9ca84a7f4492f094d1a8f3c86f3 to your computer and use it in GitHub Desktop.
Save cyberfly/3f01e9ca84a7f4492f094d1a8f3c86f3 to your computer and use it in GitHub Desktop.

Note

  1. Dynamic routes not working if refresh or directly type the address. Refer Solution #1 or Solution 2
  2. Internationalize routing not working, need to build the feature by yourself
  3. Middleware not supported

Solution 1

Set server config to load HTML file

vercel/next.js#10522 (comment) vercel/next.js#32375 (comment)

Solution 2 (building a known list eg blog post)

getStaticProps() and getStaticPaths()

https://stackoverflow.com/a/63716742/417899

Alternative Solution

Use hash /post#<post_id> or query param /post?id=123

const nextConfig = {
trailingSlash: true,
images: {
loader: "akamai",
path: "",
},
};
module.exports = nextConfig;
// https://stackoverflow.com/a/70047180/417899
// and do not use next/image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment