Netlify is a platform that hosts websites and web apps. It makes it easy to deploy, manage, and deliver your site to users quickly and securely.
Click to reveal answer
intermediate
Which file in an Astro project typically defines the build output directory for Netlify?
The astro.config.mjs file defines the build output directory, often set to dist/, which Netlify uses to serve the site.
Click to reveal answer
beginner
What is the first step to deploy an Astro site to Netlify?
Connect your GitHub (or GitLab/Bitbucket) repository to Netlify so it can access your project code and build it automatically.
Click to reveal answer
intermediate
How does Netlify know how to build your Astro project?
Netlify uses the build command you specify (usually npm run build) and the publish directory (usually dist/) to build and serve your site.
Click to reveal answer
intermediate
Why is it important to set environment variables in Netlify for some Astro projects?
Environment variables store sensitive info like API keys. Setting them in Netlify keeps secrets safe and allows your site to use them during build or runtime.
Click to reveal answer
What is the default folder Netlify serves after building an Astro project?
Apublic/
Bsrc/
Cdist/
Dbuild/
✗ Incorrect
Astro outputs the built site to the dist/ folder by default, which Netlify serves.
Which command is commonly used to build an Astro project for Netlify deployment?
Anpm run build
Bnpm run start
Cnpm install
Dnpm run deploy
✗ Incorrect
The npm run build command compiles the Astro project into static files for deployment.
How do you connect your Astro project repository to Netlify?
AUpload files manually via FTP
BUse Netlify CLI only
CEmail Netlify support
DLink your Git repository in Netlify dashboard
✗ Incorrect
Netlify connects directly to your GitHub, GitLab, or Bitbucket repository to automate builds and deploys.
Why might you need to set environment variables in Netlify for your Astro site?
ATo change the site theme
BTo store API keys securely
CTo speed up builds
DTo add custom fonts
✗ Incorrect
Environment variables keep sensitive data like API keys safe and accessible during build or runtime.
What file usually contains the build output directory setting in an Astro project?
Aastro.config.mjs
Bpackage.json
Cnetlify.toml
Dindex.html
✗ Incorrect
The astro.config.mjs file configures the build output directory for Astro projects.
Explain the steps to deploy an Astro project to Netlify starting from your code repository.
Think about how Netlify automates deployment using your Git repo and build settings.
You got /5 concepts.
Describe why environment variables are important when deploying an Astro site to Netlify and how you set them.
Consider security and configuration needs for your deployed site.
You got /4 concepts.
Practice
(1/5)
1. What is the main purpose of deploying an Astro site to Netlify?
easy
A. To make the site live and accessible on the internet
B. To edit the site's source code directly on Netlify
C. To convert the site into a mobile app automatically
D. To backup the site files locally on your computer
Solution
Step 1: Understand deployment meaning
Deployment means making a website available online for others to visit.
Step 2: Identify Netlify's role
Netlify hosts your Astro site so it can be accessed on the internet anytime.
Final Answer:
To make the site live and accessible on the internet -> Option A
Quick Check:
Deploying = Making site live [OK]
Hint: Deployment means putting your site online for everyone [OK]
Common Mistakes:
Thinking Netlify edits code directly
Confusing deployment with app conversion
Assuming deployment is just local backup
2. Which file is commonly used to specify the build command when deploying an Astro site to Netlify?
easy
A. package.json
B. netlify.toml
C. astro.config.mjs
D. index.html
Solution
Step 1: Identify Netlify configuration file
Netlify uses netlify.toml to set build commands and publish directories.
Step 2: Differentiate from other files
package.json manages dependencies, astro.config.mjs configures Astro, and index.html is a page file.
Final Answer:
netlify.toml -> Option B
Quick Check:
Build commands set in netlify.toml [OK]
Hint: Netlify uses netlify.toml for build settings [OK]
Common Mistakes:
Confusing package.json with Netlify config
Thinking astro.config.mjs controls deployment
Using index.html for build commands
3. Given this netlify.toml snippet:
[build]
command = "npm run build"
publish = "dist"
What happens when you push your Astro site to Netlify?
medium
A. Netlify fails because dist is not a valid folder
B. Netlify ignores the build command and publishes the root folder
C. Netlify runs npm start and publishes the src folder
D. Netlify runs npm run build and publishes the dist folder
Solution
Step 1: Understand build command in netlify.toml
The command npm run build tells Netlify how to build the site before publishing.
Step 2: Understand publish directory
The publish folder dist is where the built site files are located for Netlify to serve.
Final Answer:
Netlify runs npm run build and publishes the dist folder -> Option D
Quick Check:
Build command + publish folder = deploy site [OK]
Hint: Build command runs, then publish folder is served [OK]
Common Mistakes:
Assuming Netlify uses npm start by default
Thinking Netlify publishes source files directly
Believing dist folder is invalid
4. You deployed your Astro site to Netlify but the site shows a 404 error. Which is the most likely cause?
medium
A. The publish directory in netlify.toml is set incorrectly
B. You forgot to push your code to GitHub
C. Netlify does not support Astro sites
D. Your site has no index.html file in the root folder
Solution
Step 1: Check publish directory setting
If the publish folder is wrong, Netlify serves an empty or wrong folder causing 404 errors.
Step 2: Verify other options
Code pushed to GitHub is needed but usually causes build errors, not 404. Netlify supports Astro. The index.html is inside the publish folder, not root.
Final Answer:
The publish directory in netlify.toml is set incorrectly -> Option A
Quick Check:
Wrong publish folder = 404 error [OK]
Hint: Check publish folder path if site shows 404 [OK]
Common Mistakes:
Blaming Netlify for no Astro support
Assuming missing index.html in root causes 404
Ignoring publish directory misconfiguration
5. You want to deploy an Astro site to Netlify with a custom domain and automatic updates on every Git push. Which steps should you follow?
hard
A. Push your code to GitHub, then email Netlify support to deploy your site
B. Upload your site files manually to Netlify, then buy a domain from Netlify
C. Connect your Git repo to Netlify, set build command and publish folder, then add your custom domain in Netlify settings
D. Create a new Astro project on Netlify dashboard and copy-paste your code there
Solution
Step 1: Connect Git repo to Netlify
Linking your GitHub repo allows Netlify to pull code and build automatically on pushes.
Step 2: Configure build and publish settings
Set the build command (e.g., npm run build) and publish folder (e.g., dist) in Netlify.
Step 3: Add custom domain in Netlify
Use Netlify's domain settings to add your own domain for the site URL.
Final Answer:
Connect your Git repo to Netlify, set build command and publish folder, then add your custom domain in Netlify settings -> Option C
Quick Check:
Git + build + domain = full Netlify deploy [OK]
Hint: Connect Git, set build, add domain for full deploy [OK]
Common Mistakes:
Uploading files manually instead of Git integration
Thinking Netlify needs manual deploy requests
Trying to create Astro projects inside Netlify dashboard
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.