0

I'd like to use Next.js static site export, but I'd also like to have dynamic components within the templates so that a build wouldn't need to be done every time they change, for example, a 'navigation' component. From what I've read this doesn't seem possible? Are there any workarounds, aside from creating a separate client-side build step?

1 Answer 1

1

Next is working on allowing for a combined static + SSR generated site, but they're not there yet. I see a few options currently:

  1. You can export a static site, but have that static site make api calls, etc. So you can load your navigation or whatever via api calls. Benefit - no new build. Drawback - those links/that markup is not available to search engines and won't appear initially for users.
  2. If you're using a CMS and CI system (eg, WordPress for content, Travis for CI), you can set up webhooks or functions in WordPress to fire and trigger a rebuild & deploy in Travis when your content changes.
  3. Go full SSR. It still delivers a fully rendered "static" page to the browser, it's just not a static HTML file at build time but one at run time. This is your best option if you need to have your dynamic content rendered immediately for the user and don't want to build with every change.
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for the answer. We've already opted for the first recommendation as it's the most flexible, in my opinion. #2 we have a large number of posts so it wouldn't be a viable option to rebuild all those posts on change. #3 we'd prefer to have static pages because from my understanding rendering static html is more performant than SSR.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.