New title for weekend

June 20, 2024

When to Use Static Generation vs. Server-side Rendering

Hello

We racommend using Static Generation (with and without data) whenever possible because your page can be build once and served by CDN, wich makes it much faster than having a server render the page on every request.

You can use Static Generation for many types of pages, including:

You should ask yourself: "Can I pre-render this page ahead if a user's request?" If the answer is yes, then you should chose Static Generation.

On the other hand, Static Genertion is not a good idea if you cannot pre-render a page ahead of a users's request. Maybe your page shows frequently updated data, and the page content changes on every request.

In that case, you can use Server-Side Rendering. It will be slower, but the pre-rendered page will always be up-to-date. Or you can skip pre-rendering and use client-side Javascript to populate data.

Related:

-- Back to home