Rendering Strategies in Astro: SSR and SSG
Get familiar with rendering strategies in Astro, SSG, and SSR and learn how to enable SSR in Astro.
We'll cover the following
Astro originally started out as an
Defining the terms
In this lesson, we’ll briefly explore when to use SSR and when to use SSG. We’ll also delve into how to enable SSR in Astro. But, first, let’s define the terms.
SSR involves rendering web pages on the server and then sending the fully rendered page to the client’s browser. This means that when a user requests a page, the server dynamically generates the HTML content and sends it to the client.
SSG, on the other hand, pregenerates HTML files for each page during the build process. This is Astro’s default approach. These static HTML files are then served directly to clients, eliminating the need for SSR during runtime. This results in faster website performance compared to SSR. To summarize, both SSG and SSR are distinct rendering strategies.
Get hands-on with 1400+ tech skills courses.