1

I'm using React/NextJS to create an application which will eventually be served as a static site. I have predefined urls I need to create in subdirectories. For example, /technology/ should go to /technology/index.html

How do I create this in the Nextjs pages structure?

I've tried various combinations of the following, with no luck:

  • Adding trailingSlash to my nextjs config:
module.exports.trailingSlash = true;
  • Adding technology.js to my pages directory (also tried /technology/index.js)

  • Adding exportPathMap to my next.config.js:

exportPathMap: async function (
    defaultPathMap,
    { dev, dir, outDir, distDir, buildId }
  ) {
    return {
      '/': { page: '/' },
      '/technology/index.html': { page: '/technology' },
    };
  },
  trailingSlash: true
shackleton
  • 701
  • 1
  • 12
  • 27

0 Answers0