1

How can we add a dynamic path in the exportPathMap in next.config.js to link to a specific page? The dynamic URL will be created during run time.

Scenario- URL: https://www.example.com/customers/32132-cid-1312

In the above URL part after the domain is dynamic and this happens at runtime so we cannot generate pages at build time for this.

How can we link all these dynamic URLs to a specific page?

my next.config.js

exportPathMap: async function(defaultPathMap) {
    return {
      "/404.html": {page: '/_error'},
      "/": { page: "/" },
      "/platform": { page: "/platform" },
      "/customers/:id": { page: '/customers' },
    };
  }

Last part for the customer, id is dynamic and it generated at run time. And I want to link all of those to the customer's page at run time. These sets of pages for this scenario cannot be generated at runtime.

Please help!

  • I'm on the same scenario, I readed something from [here](https://stackoverflow.com/questions/62057131/next-js-getstaticpaths-list-every-path-or-only-those-in-the-immediate-vicinity) what say to define in `getStaticpaths` the paths. I'm not sure how implement that. – Raul Feb 23 '21 at 08:24

0 Answers0