Environments allow you to use different values in your website depending on where it is deployed. For example, you could use a different CDN for your development, staging and production sites.
To change the environment variables for your site:
CloudCannon by default sets the Jekyll build environment to production. Running Jekyll locally defaults to development.
CloudCannon defaults to production. Running Jekyll locally defaults to development.
Jekyll exposes the environment with
jekyll.environment. You can use this to create separate configurations.
Here’s a short example using variables from
CloudCannon by default sets the Hugo build environment to production.
hugo locally defaults to production. Running
hugo server locally defaults to development.
To change the environment on your local machine, set it before running Hugo:
You can set the Hugo environment using the
—-environment flag in the command line. Learn more about build configuration.
Hugo exposes the environment with
Using a configuration directory allows you to create separate configurations for each environment. See the example in the Hugo documentation.