Nuxt Static Site generation

up:: Nuxt Nuxt can pre-render sites. This is good for static sites that don’t change. For dynamic sites it doesn’t work. Authorisation specifically breaks pre-rendering.

Different rendering modes

  • static: Renders on the server on request and caches that build. Renders the build on subsequent requests.
    • This is good for sites with a lot of pages, e.g. Wikipedia, when you don’t want to wait a long time for all pages to build.
  • swr: Serves the cache to the request, then re-builds the site.

Config

In nuxt.config.ts:

nitro: {
	prerender: {
		routes: ['/landing']
	}
}