4 ms·
Yup (static site generation)! But more complex than a traditional SPA setup. Traditionally an SPA has been just one single bundle file that is downloaded. With
by Tehnix 4y ago
Yup (static site generation)! But more complex than a traditional SPA setup.
Traditionally an SPA has been just one single bundle file that is downloaded. With SSG you pre-generate a file per path which gives the user many of the benefits of SSR on that first page load, before the SPA part takes over again.
- ZephyrBlu 4y agoYou are slightly conflating SSG with SPAs. SSG doesn't necessarily mean you have an SPA-like site, it could just be a MPA (I.e. classic website).
- eric-burel 4y agoMany answers are in this thread, I should have made my point clearer: from Perseus doc, it has a limited vision of static rendering, that stems from a slightly incorrect mental model. Statically rendering and not needing a server are different subject, and statically rendering is not limited to generic content. This can be easily proven if you think statically rendering a page as precomputing the render at build-time. I've written multiple time about this subject and Next 13 App Router design choices are consistent with this theory. This makes Next much more powerful that many competitors, as it covers all use cases of static rendering.
- re-thc 4y agoYou also get disadvantages. SPA due to its history is widely supported. SSG not so much e.g. from a routing perspective. It's good if your platform can support it.
- satvikpendem 4y agoBut...SSG is how pages traditionally worked. You have some files in a folder and use <a> to link between them, no dedicated router required. Routers are needed in SSR though, depending on your use case.
- re-thc 4y agoAnd traditionally it was limited so different expectations. If you needed more you'd use PHP or something else. Problem here as other commenters have mentioned is how the line between SSR, SSG and others have been blurred. We're now given something that has routing i.e. NextJs but then allowed a SSG option that behaves somewhat different.
- eric-burel 4y agoSSG in Next vocabulary (which I employ because Perseus claims to be a Next alternative) is prerendering a page at build-time, not necessarily the whole site. So Next will still allow client-side routing, with its hybrid approach. What you describe is an exported app, sometimed named SPA (the name is wrong but people get the point), MPA or static app.
- keyle 4y agoOk that's what we used to call cached websites before. Basically slap a header and footer on a bunch of pages.
- eric-burel 4y agoYes and no, it's caching at application level instead of network level with cache headers. HTTP caching is slightly more limited because the cache key is harder to tweak, so it's harder to cache paid content this way for instance.