Set the title and meta tags with svelte:head, prerender static pages, choose an adapter, and build for production.
Why: a page that’s the same for everyone can be turned into plain HTML at build time — instant to load and cheap to host. Export prerender = true from the page (or a layout, to cover a whole section).
// src/routes/about/+page.ts
export const prerender = true // build this page to static HTMLWhy: two more switches per route. ssr = false skips server rendering (makes that route a client-only app); csr = false ships no JavaScript (a fully static page). Defaults are on — change them only when you have a reason.
// In a +page.ts or +layout.ts
export const ssr = true // render on the server (default)
export const csr = true // hydrate/run JS on the client (default)
// e.g. for a purely static page: export const csr = falseWhy: an adapter packages your built app for where it will run. adapter-auto guesses common hosts; adapter-node makes a Node server; adapter-static turns the whole site into files. Set it in svelte.config.js.
// svelte.config.js
import adapter from '@sveltejs/adapter-node'
export default {
kit: {
adapter: adapter(),
},
}Why: deploying means running the production build. "build" compiles the optimized app; "preview" runs it locally so you can check it before shipping. Your host then runs the output the adapter produced.
$ pnpm build$ pnpm preview