Choose your preferred SSG:
Choose your preferred SSG:

Changing your SSG CLI options

Most static site generators offer a number of configuration options for use on the command line. Configure these and other CloudCannon-specific build options per site.

To change a command line build option:

  1. Go to the Site Settings / Build section
  2. Change details for one or more options
  3. Click Update Configuration

See in-depth details for configuring Environments and Optimizations

Build Configuration interface

Using Environment Variables

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:

  1. Go to the Site Settings / Configuration section
  2. Create/edit your environment key and value under Environment Variables
  3. Click Update Build Details
\n"}]},{"tab_name":"Hugo","doc_blocks":[{"_bookshop_name":"text","content_markdown":"CloudCannon defaults to **production**. Running `hugo` locally defaults to **production**. Running `hugo server` locally defaults to **development**.\n\nTo change the environment locally, set it before running Hugo:","col":"1"},{"_bookshop_name":"code-block","source":"shell","language":"shell","code_block":"$ HUGO_ENV=production hugo"},{"_bookshop_name":"text","content_markdown":"You can set the Hugo environment using the `—-environment` flag in the command line. Learn more about [build configuration](/documentation/build/setup/configuration/).\n\nHugo exposes the environment with `hugo.Environment`.\n\nUsing a configuration directory allows you to create separate configurations for each environment. See the example in the [Hugo documentation]({: target=\"_blank\" rel=\"noopener\"}.","col":"1"}]},{"tab_name":"Eleventy","doc_blocks":[{"_bookshop_name":"text","content_markdown":"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.\n\nTo change the environment locally, set it before running Eleventy:","col":"1"},{"_bookshop_name":"code-block","source":"shell","language":"shell","code_block":"$ ELEVENTY_ENV=production npx @11ty/eleventy"}]},{"tab_name":"Other","doc_blocks":[{"_bookshop_name":"text","content_markdown":"CloudCannon does not set default environment variables for other SSGs.\n\nTo change an environment variable locally, set it before running your build command:","col":"1"},{"_bookshop_name":"code-block","source":"shell","language":"shell","code_block":"$ MY_ENV_VAR=hello "}]}],"counter":1,"baseurl":"/documentation"};

Jekyll content

CloudCannon defaults to production. Running Jekyll locally defaults to development.

$ JEKYLL_ENV=production bundle exec jekyll serve

Jekyll exposes the environment with jekyll.environment. You can use this to create separate configurations.

Here’s a short example using variables from _config.yml:

  asset_url: "http://localhost:1337/"
  app_url: "http://localhost:3000/"

  asset_url: ""
  app_url: ""

  asset_url: ""
  app_url: ""
<!DOCTYPE html>

    <title>Environment Test</title>
    <p>Environment: {{ jekyll.environment }}</p>
    <p>Asset URL: {{ site[jekyll.environment].asset_url }}</p>
    <p>App URL: {{ site[jekyll.environment].app_url }}</p>
    <p>Development Asset URL: {{ site.development.asset_url }}</p>
    <p>Production Asset URL: {{ site.production.asset_url }}</p>
    <p>Staging Asset URL: {{ site.staging.asset_url }}</p>
    <p>Development App URL: {{ site.development.app_url }}</p>
    <p>Staging App URL: {{ site.staging.app_url }}</p>
    <p>Production App URL: {{ site.production.app_url }}</p>

Hugo content

Eleventy content

Other content

Was this article helpful? or Suggest an improvement >

Related articles