我正在使用 next.js 构建一个静态站点,我想要我的 website.com/about.html
工作就像:website.com/about
-- 我不知道为什么它强制我输入 .html
.
即使我构建了我的项目:pages/about/index.js
-- 它生成一个 about.html
而不是 about/index.html
在静态网站上。
最佳答案
我在 next 的网站上找到了答案:
module.exports = {
exportTrailingSlash: true,
}
https://nextjs.org/docs/api-reference/next.config.js/exportPathMap#adding-a-trailing-slash
关于next.js - 如何在 next.js 中省略 html 扩展名?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62866083/