I have a current application which is located at “cp-com-3.netlify.com” 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.
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).
NOT configure the specific environment variable that controls the language in the toml file
then, make a second site, linked to the same repo as the first.
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
Re-awakening this thread because I essentially have the same question.
Current: one repo and one site.
Desired: multi-lingual deployment.
Specific desired: a single netlify.toml file that has all the info so that we’re not relying on the Netlify gui.
I’ve read the docs, and we can do it that way (multiple sites and defining the build commands within the Netlify gui), but currently I enjoy having the build command(s) within the repo (so that everything is in one place and we can more easily align CI, docs, and Netlify deploy).
Not sure how useful it is for your use-case, but you can have a monorepo and then host multiple projects inside a single repo allowing you to have an individual toml for each site. It’s not exactly one toml for multiple sites, but at least all your sites can be configured using a toml of their own while still having a single repo.
Ooh awesome, thank you! I didn’t realise this was possible. Do you happen to have an example of a project which is set up like that which I could have a look at?
Not an exact example, but this should also work: hrishikesh-k/blog. The only “deployable site” that I have in that folder is in the packages/site folder, and it has its own toml: blog/packages/site/netlify.toml at main · hrishikesh-k/blog, but you can use that same structure and add a toml in each folder that you need a separate site for.