Last reviewed by Netlify Support staff: October 2024
There are some projects that reside in a folder instead of the root of your Git repository. If you need to deploy your site from a subdirectory, Netlify offers advanced monorepo configuration options for manually setting your directories in the UI or netlify.toml file, or relying on automatic monorepo detection to configure directories for you.
Manual Configuration
Via the UI
In your site dashboard, for the specific site you want to configure, go to Site Configuration > Build & deploy > build-settings. There, you can set the base, package (if applicable), and publish directories, as well as your build command:
You can set the base and public directories as well as the build command in a netlify.toml file. The package directory can only be configured via the UI. This section in the netlify.toml file might look something like this:
Now, your builds will work from the subdirectory folder mentioned above! If you have any issues, comment below.
Automatic Monorepo Detection
When you create a new site from an existing repository, Netlify automatically scans the repo to see if it contains multiple sites. If so, Netlify displays a Site to Deploy dropdown menu containing a list of available sites and directories:
But we always got this error failed during stage 'building site': Deploy directory 'frontend/foo/frontend/foo/storybook-static' does not exist Not sure why but seems the base got included twice for the deploy dir
Hi @zipme, it looks like this bug was introduced in the update that improves monorepo handling. We have an issue filed for it and will let you know as soon as we get things fixed.
This absolutely should work @jayemfonacier and I believe that something else must be at play! If youâre happy with the workaround, great â otherwise, please create a topic and we can delve in on this one.
Hi, I deloyed a website on Netlify. This is a small website with a couple of pages,js and css, which they all live in a âdistâ folder. they are in my repo and the path is like this: dist/index.html
So I changed my Publish directory using Netlify UI to âdistâ. But it doesnât work and Page Not Found is appeared after I click on automatically-generated domain name by Netlify.
What exactly should I write including / or . in Base directory, Build command, and Publish directory fields in Netlify UI?
Hi @luke, Thank you for your reply.
I changed my settings to the things you said, but it doesnât work.
This is my site: friendly-mccarthy-00cc03.netlify.app
Please let me know if I should provide you with more information.
6:55:42 PM: Different build dir detected, going to use the one specified in the Netlify configuration file: 'dist' versus '/dist/' in the Netlify UI
6:55:42 PM: No build command found, continuing to publishing
6:55:42 PM: Starting to deploy site from ''
You will need to deploy your site again for the changes to take effect.
@luke, @Scott. Hi there, I have a similar issue so I decided not to make an extra issue in forums for this.
I got a static (js, css, html only) website at my root folder which also contains a _headers file (no issue with it). But, thereâs a folder named blog at <root>/blog and it is made with hugo - a static site generator. My issue here is how can I deploy hugo commands to build the website for the blog folder only.
I tried to use netlify.toml file in <root>/blog with the following code:-
but for some reason, it isnât working. I donât think thereâs a way to run the environment variable and command in the netlify backend dashboard where thereâs a option but as I said, my main website at root is a static website.