Skip to content

Netlify

How to Deploy an Astro Website to Netlify

Netlify is one of the most popular static hosting platforms. It offers free hosting, automatic Git deploys, and a global CDN.

This guide walks you through deploying your Blacks project to Netlify.


Netlify Deploy

Netlify astro js themes template

Step 1 — Create a Netlify Account

Go to netlify.com and sign up. You can register directly with your GitHub account — this simplifies the connection later.

Step 2 — Create a New Project

From your Netlify dashboard:

  1. Click Add new site → Import an existing project
  2. Select GitHub and authorize Netlify
  3. Choose your Blacks repository from the list

Step 3 — Configure Build Settings

Set the build settings:

SettingValue
FrameworkAstro
Build commandnpm run build
Publish directorydist

Then click Deploy site.

Your site goes live at:

https://your-project.netlify.app

Every future push to your Git repository triggers an automatic build and deploy.


Add a Custom Domain

If you want to use your own domain name:

  1. Go to your Netlify project dashboard
  2. Click Domain settings → Add custom domain
  3. Enter your domain name
  4. Add Netlify’s nameservers to your domain registrar

Netlify provides a free SSL certificate automatically once DNS is configured.

How to Set Up Netlify DNS

  1. In Netlify, go to Domain management
  2. Click Add domain
  3. Copy Netlify’s nameservers (they look like dns1.p01.nsone.net)
  4. Log in to your domain registrar (Namecheap, GoDaddy, Cloudflare, etc.)
  5. Replace your domain’s nameservers with Netlify’s
  6. Wait for DNS propagation (5 minutes to 24 hours)

After propagation, your domain points to Netlify and HTTPS is enabled automatically.


Build Settings Summary

SettingValue
Build commandnpm run build
Publish directorydist
FrameworkAstro
Node version20 or newer

Troubleshooting

ProblemSolution
Build failsCheck that Node.js version is 20 or newer
404 errors on the live siteVerify publish directory is dist
Images not loadingCheck site URL in astro.config.mjs
Custom domain not workingWait for DNS propagation, or check nameservers
Changes not showingHard refresh in your browser (Ctrl + Shift + R)


Next Step

Explore other hosting options:

👉 Vercel — frontend-focused platform with instant preview deploys