Tips
Head Management
To manage the <head> section of your HTML document, use Svelte's native <svelte:head> element. This allows you to dynamically set metadata such as the page title and meta tags for each route. See the Svelte documentation.
svelte
<svelte:head>
<title>About</title>
<meta name="description" content="..." />
</svelte:head>Error Boundaries
To catch and handle errors in your application, use Svelte's native <svelte:boundary> element. This allows you to define error boundaries and display fallback UI when errors occur for each route. See the Svelte documentation.
SPA Deployment
When deploying a Single Page Application, ensure your web server is configured to handle client-side routing:
- Platforms like Vercel and Cloudflare Pages natively support SPAs and require no additional configuration.
- For Netlify, see the official documentation on redirects for SPAs.
- For Nginx, use the
try_filesdirective to serveindex.htmlfor all routes. - For Apache, use the
FallbackResource /index.htmldirective to redirect all requests toindex.html. - For AWS Amplify, see the official documentation on redirects for SPAs.
- For Azure, see the official documentation on route configuration.