One TOML file for multiple sites?


I have a current application which is located at “” its a Gatsby/Wordpress headless app. The wordpress site is hosted at another party.

We want to localize this application for another geographic region, to do that we are standing up another headless Wordpress site, and creating a new “site” inside of netlify. Inside of our sites ENV file we are trying to tell each environment where to get its content.

Because ideally we have one codebase to support both these sites, I want to know is there a way inside of the TOML to distinguish which netlify “SITE_ID” the TOML is inside of? OR can I set an environment variable at the site level and then inside the TOML use that to change the source of the content.

Is there a better/smarter way of doing this?

Much appreciated.

hmm, I’m not 100% sure about this, but would a monorepo serve your needs?

Close. My app folder is always the same name but I could rename the app folders for the build process and maybe that would work?

Thanks for the comment, its really appreciated.

I think that in your situation, I would:

  1. configure everything obvious in the toml file. These would be all the settings that are the same for both sites (e.g. build command, API endpoints, etc).
  2. NOT configure the specific environment variable that controls the language in the toml file
  3. then, make a second site, linked to the same repo as the first.
  4. instead, configure that or those language-specific variable(s) in each site’s environment variable settings. (That’s on the build & deploy settings page about halfway down).

You get:

  • “templated” site with all common config in netlify.toml
  • ability to set single-site settings in our UI
  • all of those settings are available during build

Could that work for you?

Hey Chris,

Yeah actually landed on this solution myself, using a mix of env variables and toml key/values/conditionals.

Thanks for suggesting it.

1 Like