How to branch a site and have different text on each

Hi Netlify Community!

I would like to use my master branch as a template and creates sites/branches that are exactly the same as master, except I would like some of the text to be custom for each branch (for example, H1). I am currently using the Hugo config.toml file to store my text as parameters.

Ideally, when I would need to modify the template, I would only need to modify the master branch and then I would merge those changes into each of the other branches and redeploy. However, I would like to do this without overwriting the custom text saved in each of the branches.

I was thinking maybe I could keep ALL of the custom text as named parameters in config.toml and then somehow make each site “aware” of the branch it is in, thereby allowing it to spit out the correct text for that branch. But how would I do this to make it aware? Could I use Netlify environment variables or something similar?

I am going down the right path at all?

Any help you could provide would be much appreciated.

Thanks so much for your help! Loving Netlify and JAMstack so far!

This pattern shows a “per-branch” configuration using environment variables:

Of course - if your custom text is not in conflict with the changes you make to master, git will also “sort things out for you” while you merge, so maybe you don’t even need to get that fancy :slight_smile: