Hey @emma,
There are a few different options for this. This is a nice blog post that outlines one of the more complicated to set up but more elegant and easier to manage ways:
Alternatively, you can go the “easier to set up but less elegant” way This was is to have a different Netlify site for each of your subdirectories. You would deploy each site from the same repo but set the base in your Netlify site dashboard or netlify.toml
file to be the subdirectory you want to build. It would look something like this, assuming your github repo is like github.com/emma/website/project1
:
mywebsite.com
- deploys on main-site.netlify.app from github.com/emma/website repo
# netlify.toml
[build]
// only build homepage
command = "webpack"
[[redirects]]
from = "/project1/*"
to = "project-1.netlify.app/:splat"
status = 200
force = true
from = "/project2/*"
to = "project-2.netlify.app/:splat"
status = 200
force = true
mywebsite.com/myproject1
- deploys on project-1.netlify.app from github.com/emma/website repo
- be sure to deploy to a subdirectory, not the root of the project, as described here
# netlify.toml
[build]
base = /myproject1
// build command for myproject1 directory
command = "webpack"
mywebsite.com/myproject2
- deploys on project-2.netlify.app from github.com/emma/website repo
- be sure to deploy to a subdirectory, not the root of the project, as described here
# netlify.toml
[build]
base = /myproject2
// build command for myproject2 directory
command = "webpack"
… and repeat for /blog. Let us know if that helps or if you have questions along the way!