#ssg
1 messages · Page 1 of 1 (latest)
In Astro, you can configure a particular page to be server-side rendered by using the output: 'server' or output: 'hybrid' modes in your Astro configuration.
For instance, to configure a highly dynamic app where every page is rendered on demand by default, you can add output: 'server' to your Astro config:
// astro.config.mjs
import { defineConfig } from 'astro/config';
import node from "@astrojs/node";
export default defineConfig({
output: 'server',
adapter: node({ mode: "standalone" })
});
However, if you want to override the default on-demand rendering of server mode on a specific page or route, you can do so by exporting const prerender = true in that page:
// src/pages/my-static-page.astro
---
export const prerender = true;
// ...
---
<html> <!-- Static, pre-rendered page here... --></html>
This will make the specific page statically pre-rendered, overriding the default server-side rendering.