One code base, two Netlify sites

We’re trying to deploy our website twice, in two separate Netlify sites. It’s a Gatsby build pulling content from a headless CMS, and we will use env vars to specify the different settings (along with some other bits like redirects, which are currently in netlify.toml).

However, this doesn’t seem possible:

  • the monorepo functionality centres on different base folders, which we don’t have, and setting it changes the published directories as well
  • We can’t specify a different name for the config file

Is there any guidance on how we can achieve this?

I think you can create 2 difference branches that are in sync with each other and create a different Netlify website at both the branches.

@wild I’ve been able to create multiple sites from the same code base on Github, but I wasn’t using Gatsby.

1 Like

Interesting, thanks @gregraven - would you mind sharing how you’re dealing with the config? Do they both use the same netlify.toml?

I mentioned Gatsby for completeness but don’t think it’s the root of the problem, any similar setup would run into the same issue.

Thanks for the suggestion, I’ve done that as a workaround but different branches can’t have completely different domains, I think?

While creating a new website you can select which branch to publish. It will be used as your production branch and since it’s a new Netlify website, you would get different domains.

@wild I build static sites locally and upload them via drag-n-drop, so I almost never have a netlify.toml file. Sorry.