next.js - 如何在 next.js 中省略 html 扩展名?

标签 next.js

我正在使用 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/

相关文章:

javascript - 如何在 Next JS Application 中将 String 转换为 HTML 元素?

docker - 下一个JS : Prevent env vars to be required on build time

reactjs - 情感风格不是压倒一切的组件

javascript - 如何解决 "Greetings, time traveller. We are in the golden age of prefix-less CSS, where Autoprefixer is no longer needed for your stylesheet."?

next.js - Next.js 中的控制 header

javascript - 在 React 中将函数组件转换为类组件

javascript - Next.js 图像组件 Tailwind-css 不起作用

javascript - 除非我专门刷新页面,否则脚本无法在 React、NextJS 项目中工作

javascript - 在 reactjs 和 nextjs 构造函数中获取引用错误 : localstorage is not defined

javascript - 使用 getStaticPaths 参数时如何键入 getStaticProps 函数?