Deployment Guide
This theme is compatible with Netlify, Vercel, and Cloudflare Pages. Below, you will find configuration details for each platform to ensure a smooth deployment process.
Learn more in official documentation.
Netlify Deployment
To deploy your project on Netlify, simply use the provided netlify.toml
file. This file defines the build settings and cache headers. Here’s what the file does:
- Build Settings: Specifies the
publish
directory (dist
) and the build command (yarn build
). - Node Version: Sets Node.js version 22 for compatibility.
- Cache-Control Headers: Ensures optimal caching for assets in the
_astro
andimages
folders.
Steps
- Create a new site on Netlify.
- Connect your Git repository.
- Ensure the
netlify.toml
file is in the root of your project. - Netlify will automatically use the settings from the
netlify.toml
file to build and deploy your site.
Vercel Deployment
For Vercel, you can use the provided vercel.json
file along with a custom build script (vercel.sh
). This script ensures that the correct base URL is used for production and preview environments.
Steps
- Create a new project on Vercel.
- Connect your Git repository.
- Ensure the
vercel.json
andvercel.sh
files are in the root of your project. - The
vercel.json
file contains important configurations, like setting the trailing slash behavior and defining redirects (e.g.,/sitemap.xml
to/sitemap-index.xml
). - The
vercel.sh
script automatically detects whether the deployment is for production or preview and sets the base URL accordingly before running the build.
Cloudflare Pages Deployment
Cloudflare Pages supports deploying your Astro.js theme easily, though the configuration is slightly different from Netlify and Vercel. Here’s how you can deploy:
Steps
- First add following code in
astro.config.mjs
file - Create a new project on Cloudflare Pages.
- Connect your Git repository.
- Ensure that the build settings are configured to build your site with
yarn build
and output to thedist
directory. - Cloudflare Pages should automatically pick up your site configuration, but you may need to set the environment to Node.js 22 for compatibility.