question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dynamic routing with next export to static

See original GitHub issue

Hi, according to the v3-beta docs, next.js support exporting to static html, and apparently also support “dynamic routes”. Was wondering if there was some documentation on how to create dynamic routes when exporting static html.

This is a way to run your Next.js app as a standalone static app without any Node.js server. The export app supports almost every feature of Next.js including dynamic urls, prefetching, preloading and dynamic imports.

I’ve added this to my next.config.js but it doesn’t seem to work.

exportPathMap: () => {
    return {
      "/": { page: "/" },
      "/account/:id": { page: "/account" }
    }
  }

I also tried "/account/*", but no luck. Any help would be greatly appreciated.

  • I have searched the issues of this repository and believe that this is not a duplicate.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

4reactions
i8ramincommented, Jul 12, 2017

FYI, I am currently trying to handle this situation using Netlify: https://www.netlify.com/docs/redirects/

3reactions
shurvirmoricommented, May 7, 2018

I think this demo will work fine for Export as static HTML of dynamic urls. 👍 👌

https://github.com/zeit/next.js/tree/canary/examples/with-static-export

Read more comments on GitHub >

github_iconTop Results From Across the Web

NextJs: Static export with dynamic routes - Stack Overflow
I think without this netlify hack, my goal of static export + working links to dynamic routes is not possible with next.js according...
Read more >
Advanced Features: Static HTML Export | Next.js
Export your Next.js app to static HTML, and run it standalone without the need ... file for each page in your pages directory...
Read more >
Static export and dynamic route #32375 - vercel/next.js - GitHub
Hello, i have a dynamic route to edit a customer: image. i'm using static export (im not using any staticpath or staticprops methods),...
Read more >
Understanding static HTML export in Next.js - LogRocket Blog
Learn why you should use HTML static exporting from a Next.js ... Note that if you have dynamic routes set up, more pages...
Read more >
Static Site Generation with Next.js and TypeScript (Part IV)
Dynamic Routes Any page component that's defined within a file whose. ... then you can export a getStaticPaths() function that specifies the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found