Configure
Configure your site settings.
Goal: Deploy to Netlify in 5 minutes.
Deploy your Astro Swiss Theme site to production in minutes. These deployment instructions work for both the free starter theme and the paid version.
npm run buildThis creates an optimized production build in the dist/ folder.
Before deploying, test your production build:
npm run previewVisit http://localhost:4321 to preview the built site.
The build process:
Output structure:
dist/├── index.html # French homepage (default locale)├── de/│ └──index.html # German homepage├── en/│ └──index.html # English homepage├── 404.html # Language-aware 404 page├── _astro/ # Bundled CSS and JS├── fonts/ # Font files└── favicon.svgWhy Netlify?
Create netlify.toml in project root:
[build] command = "npm run build" publish = "dist"No redirect rules are needed: this is a static multi-page build, and Netlify
automatically serves the theme’s 404.html for unknown URLs. Do not add a
catch-all /* → /index.html rewrite — it would silently serve the homepage
instead of a 404 for mistyped or removed URLs.
Deploy:
npm install -g netlify-clinetlify deploy --prodThe theme ships client-side first-visit detection: a small inline script on the default-locale homepage reads navigator.language and redirects first-time visitors to /de/ or /en/ — it works on any static host, needs no configuration, and never overrides a language the visitor picked explicitly in the selector.
Optionally, Netlify users can add zero-JS server-side redirects on top:
[[redirects]] from = "/" to = "/de/" status = 302 conditions = { Language = ["de"] }
[[redirects]] from = "/" to = "/en/" status = 302 conditions = { Language = ["en"] }Broken URLs serve a real language-aware 404 page (there is no SPA catch-all): visitors get a proper 404 status with the message in French, German and English.
Vercel auto-detects Astro projects - no configuration file needed:
Or use CLI:
npm i -g vercelvercelVariables prefixed with PUBLIC_ are available in client-side code.
Create .env file:
PUBLIC_SITE_URL=https://yourdomain.comPUBLIC_GTM_ID=GTM-XXXXXXXUse in components:
---const siteUrl = import.meta.env.PUBLIC_SITE_URL;---
<meta property="og:url" content={siteUrl} />Variables without the PUBLIC_ prefix are only available at build time (and server-side, if you opt a route into on-demand rendering) — they are never exposed to the browser.
API_KEY=secret-key-hereDATABASE_URL=postgres://...Add variables in Project Settings → Environment Variables
Add variables in Site Settings → Environment Variables
Add variables in Settings → Environment Variables
Configure
Configure your site settings.
Styling
Customize your site’s appearance.
Support
Get help and support.