Search code examples
content-management-systemstatic-sitenetlify

Netlify managing and applying changes to multiple NetlifyCMS sites


Say I have 3 NetlifyCMS sites set up in GitHub and deployed/ served with Netlify. Is it possible to add a new file like index.html to all of them at once?

My first thought is to write a script that just pushes the change to each GitHub repo individually, which then gets auto-deployed by Netlify.

I'm mainly looking for any existing api, cli, etc that allows managing multiple Netlify sites (and I guess GitHub as well since Netlify is just deploying whatever is in the repo) at once. Maybe there's a magical unified backend admin page for all sites using netlifyCMS sites.


Solution

  • Disclaimer: I work for Netlify.

    Nothing magic that I'm aware of and I'm a Hogwarts alum ;)

    The typical workflow for "change one thing deploy multiple sites" is to have them all use the same repo. You can hook multiple netlify sites to the same repo, and use different build commands in each by configuring in our UI (sadly the netlify.toml file won't work for this use case since there can be only one per repo and we read it immediately before your build command could change it). Folks who do this tend to put the files for each site in a separate directory - e.g. site1/, site2/, etc , so you could either use a build command like cd site1 && do_your_build OR you could ask us at the helpdesk to set a different base attribute for each site so we START the build there (which would automatically run npm install or yarn install in the appropriate directory.

    Another workflow that could also achieve the goal would be to set up incoming webhooks at Netlify to rebuild each site and fire them all off on an update, and have your build command pull the updates from a separate location or repo. Commits to that "central" repo could do this automatically if you put 3 of those webhooks in place on your git provider.

    Effectively, you'll have to create your own "system" to do this but there is sufficient flexibility that it can be automated without any coding, just creative build commands and repo settings :)