Environment Variables are useful for feeding the build process of your static site information from outside of your site’s code. This allows for information like API keys to be stored and provided securely, rather than in your site’s code as clear text.

Adding Environment Variables

Environment variables can be added in the Build settings step when adding a static site or on your site’s Settings page after deployment.

Special Characters in Environment Variables

Environment variables are applied literally, with the exception of commas, parentheses, and double quotes. Commas are interpreted as delimiters, and parentheses can cause the deployment to fail. These cannot be used in environment variables.

Unescaped double quotes are either disregarded or will cause the rollout process to fail.

  • For example: "my_example_variable" will be applied as: my_example_variable.
  • If double quotes are inside of a string (e.g. my_exampl"e_text), the rollout process will fail.
  • To keep double quotes around a variable, escape them with a backslash (\). For example: \"my_example_var\" will be applied as: "my_example_var".
  • Double quotes inside strings can also be handled with escaping, so the rollout process can be completed. For example: my_examp\"le_var will be applied as: my_examp"le_var.

In Build Settings

To add environment variables when adding your site, expand the Environment variables section, enter the key-value pairs.

After Deployment

To add environment variables after deployment, go to your site’s Settings page, scroll down to the Environment variables section, and click Add environment variable. Add the key-value pairs in the Add environment variable modal/pop-up window.

Related Documentation