Define a variable in config file with a different value in server/build modes

Is there a way to set a variable in the config file with two different values, based on 1) build or 2) server cases.
I am already using the “.Site.IsServer” in layouts, which works great. But I would like to configure some variables at the site level, so that I don’t have to change them back and forth.

I tried the following, but it looks like these environments are constrained to the variables defined in the documentation

[build]
  myvar = "build value"

[server]
  myvar = "server value"

Any other idea?
Thanks!

https://gohugo.io/getting-started/configuration/#configuration-directory

3 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.