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 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 defaults to production. Running
hugo locally defaults to production. Running
hugo server locally defaults to development.
To change the environment locally, 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.
CloudCannon has no default. You should set your environment variables everywhere you need them before building. The Eleventy documentation mentions
ELEVENTY_ENV as a convention.
To change the environment locally, set it before running Eleventy: