Variables can be set on specific pages, or across the entire site.

Site variables

Site variables are often used to change output for development, staging, and production environments. The best place to put these is in combine.yml.

Hard-coding variables in combine.yml

  site_name: My site
  version: v3.1.1

Using environment variables in combine.yml

You can leverage environment variables keep settings out of your repo or get build environment details from your hosting provider.

    default: ""
    from_env: URL  # a Netlify variable

If you want the environment variable to be "required", then simply remove the default field.


Combine will throw an error if you use an "undefined" variable (which can help catch deployment misconfigurations if you forget to set the env variables).

    ...{{ google_tag_manager_id }}

In some scenarios, a missing environment variable is ok and you can write a special if statement to check that case. Be careful when you do this though — you lose your safety net if the env variable is accidentally removed.

{% if google_tag_manager_id is defined %}
    ...{{ google_tag_manager_id }}
{% endif %}

Page variables

The other way to use variables is to define them on specific pages. This is often used to pass the values back to the template they are extending.

An example would be setting meta values in the <head> of your root template:

<!-- base.template.html -->
  {% if title is defined %}<meta property="og:title" content="{{ title }}" />{% endif %}

Using the Jinja {% set %} tag

There is both a single-line and multi-line way to use {% set %}.

{% extends "base.template.html" %}

{% set title = "My page title" %}
{% extends "base.template.html" %}

{% set title -%}
My page title
{%- endset %}

Markdown with Frontmatter

In Markdown pages, you can set variables using YAML frontmatter.

title: My page title

My page content with frontmatter above it!

Built-in variables

There are a handful of variables that Combine sets automatically.


Automatically set to development when running combine work, and production when running combine build.


Automatically set to the current time of the build. This is the Python function and can be used in templates as {{ now().year }}, for example.


Used only in Markdown to determine which template to use for rendering the page. Set to markdown.template.html by default and can be overriden with frontmatter.


Automatically set to{port} in development, and is required by the absolute_url filter.


Automatically set to the URL of the current page when it is being built.