Configuration
The project includes avercel.json configuration file:
vercel.json
Configuration Options
Removes
.html extensions from URLs. For example, /blog.html becomes /blog.Custom HTTP headers for specific routes. Used here to cache fonts for 180 days.
Deployment Process
Connect Repository
Connect your GitHub repository to Vercel:
- Go to vercel.com
- Click “Add New” → “Project”
- Import your
website-astrorepository - Vercel auto-detects Astro framework
Configure Environment Variables
Add all required environment variables in the Vercel dashboard:Project Settings → Environment VariablesRequired variables:
NOTION_TOKENNOTION_BLOG_DB_IDNOTION_PROJECTS_DB_ID- All other
NOTION_PAGE_ID_*andNOTION_DB_ID_*variables
Environment variables are encrypted and securely stored. They’re available during build time for the Notion sync process.
Configure Build Settings
Vercel automatically detects the correct settings:
- Framework: Astro
- Build Command:
pnpm build - Output Directory:
dist - Install Command:
pnpm install
The
prebuild script in package.json runs automatically before the build, syncing content from Notion.Deployment Types
- Production
- Preview
Production deployments occur automatically when you push to the Features:
main branch:- Deployed to production domain
- Full Notion content sync
- Automatic cache invalidation
- SSL certificate
- Global CDN distribution
Build Time
Initial Build
3-5 minutes
- Install dependencies: ~1-2 min
- Notion sync: ~30-60 sec
- Astro build: ~1-2 min
- Deploy: ~30 sec
Incremental Build
2-3 minutes
- Cached dependencies: ~30 sec
- Incremental sync: ~10-20 sec
- Astro build: ~1-2 min
- Deploy: ~30 sec
Environment-Specific Behavior
The website makes zero runtime API calls to Notion. All content is fetched at build time and served as static HTML.
Triggering Rebuilds
To update content from Notion:Method 1: Manual Deploy
Method 1: Manual Deploy
In the Vercel dashboard:
- Go to Deployments
- Click the three dots on any deployment
- Select Redeploy
Method 2: Deploy Hook
Method 2: Deploy Hook
Create a Deploy Hook for automated rebuilds:
- Go to Project Settings → Git
- Scroll to Deploy Hooks
- Create a hook named “Notion Content Update”
- Copy the webhook URL
Method 3: Git Push
Method 3: Git Push
Make any commit to the main branch:
Performance Optimizations
Vercel automatically applies:- Edge caching: Static assets cached globally
- Brotli compression: Smaller transfer sizes
- HTTP/3 support: Faster connections
- Image optimization: Automatic WebP/AVIF conversion (via Astro)
- Smart CDN: Content served from nearest edge location
Custom Font Caching
Fonts are cached for 180 days (configured invercel.json):
Monitoring
Analytics
Vercel provides built-in analytics:- Page views and unique visitors
- Top pages and referrers
- Core Web Vitals (LCP, FID, CLS)
- Geographic distribution
Build Logs
Access detailed build logs in the dashboard:- Go to Deployments
- Click any deployment
- View Build Logs tab
- Notion sync output
- Build warnings/errors
- Deployment status
Troubleshooting
Build fails with 'NOTION_TOKEN is not defined'
Build fails with 'NOTION_TOKEN is not defined'
Solution: Add environment variables in Vercel dashboard.Go to Project Settings → Environment Variables and add all required Notion variables.
Content not updating after Notion changes
Content not updating after Notion changes
Solution: Trigger a manual redeploy.Changes in Notion only appear after a rebuild. Use any of the three rebuild methods above.
Build times are slow
Build times are slow
Solution: Check Notion sync performance.Review build logs to see how long the Notion sync takes. If it’s slow:
- Check if you have many unchanged posts (should use incremental sync)
- Verify Notion API response times
- Consider reducing the number of posts/projects
Images not loading
Images not loading
Solution: Verify image paths and Notion downloads.Images from Notion are downloaded to
public/ during build. Check:- Build logs for asset download errors
- Image URLs in generated MDX files
- Public directory in deployment
Next Steps
Build Process
Learn about the full build pipeline
Local Setup
Set up local development environment