Overview
The project is configured for deployment on Netlify using thenetlify.toml configuration file. This setup includes build settings, environment variables, and complex redirect rules.
Netlify Configuration
Build Settings
| Setting | Value | Description |
|---|---|---|
command | npm run build | Astro build command |
publish | dist | Output directory |
NODE_VERSION | 20.x | Node.js version |
Redirect Rules
WWW to Non-WWW
Force canonical domain without www:The
force = true flag ensures this redirect takes precedence over other rules.Content Redirects
Redirect old URLs to new blog structure:Wildcard Redirects
Handle multiple URLs with patterns::splat) captures the rest of the path.
404 Handling
Complete Redirect List
The project includes 20+ redirect rules:- WWW normalization
- Blog URL migrations
- Section reorganizations
- Language redirects
- Old promotion pages
- Legacy service URLs
Deployment Process
Initial Setup
-
Connect Repository:
- Log in to Netlify
- Click “New site from Git”
- Select your repository
-
Configure Build:
- Build command:
npm run build - Publish directory:
dist - Node version: 20.x (from netlify.toml)
- Build command:
-
Deploy:
- Click “Deploy site”
- Netlify reads
netlify.tomlautomatically
Continuous Deployment
Netlify automatically deploys on:- Push to main branch
- Pull request previews
- Manual deploys from dashboard
Environment Variables
Set in Netlify dashboard under Site settings > Environment variables:Variables prefixed with
PUBLIC_ are exposed to the browser.Build Optimization
Build Performance
Caching
Netlify automatically caches:node_modules/- Astro build cache
- npm/yarn cache
Deploy Previews
Every pull request gets a preview URL:- Full site preview
- All redirects active
- Isolated from production
Custom Domain
DNS Configuration
CNAME Record:SSL Certificate
Netlify provides free SSL via Let’s Encrypt:- Auto-renewal
- HTTPS forced by default
- Certificate visible in dashboard
Performance Features
Edge Network
- Global CDN
- Automatic asset optimization
- Brotli compression
Image Optimization
Astro’s built-in image optimization works with Netlify:Monitoring
Build Logs
Access in Netlify dashboard:- Build time
- Deploy duration
- Error messages
Analytics
Enable Netlify Analytics:- Server-side tracking
- No cookies required
- GDPR compliant
Troubleshooting
Build Fails
- Check Node version matches
netlify.toml - Verify all dependencies in
package.json - Review build logs in dashboard
Redirects Not Working
- Verify
netlify.tomlsyntax - Check redirect order (specific before general)
- Test with curl:
404 Errors
- Ensure
404.htmlexists indist/ - Check catch-all redirect is last
- Verify file paths are correct