Other configuration

Learn how to migrate your existing Site to CloudCannon's Unified Configuration file format.

You may not need to complete every step in this guide but please carefully review each step to see if it is applicable to your Site's configuration.

1. Explicitly configure attributes for file content Editable Regions#

CloudCannon no longer automatically applies Editable Regions to file content without an explicit attribute. Previously, CloudCannon would attempt to discover these regions automatically when it encountered a content variable as the only child of an element, for example:

layout.html
copied
<div>{{ content }}</div>

This markup detection was fragile in certain circumstances, and couldn't be explicitly toggled on or off.

For sites using Unified Configuration, CloudCannon will no longer discover these regions automatically. Instead, an explicit attribute now exists to add an Editable Region for the content of a file.

The below code shows how to configure the data-cms-edit="content" attribute to configure Editable Regions for your content:

layout.html
copied
<div data-cms-edit="content">{{ content }}</div>

2. Configure _snippets_imports#

This step of the migration guide is only relevant to Sites using Hugo or Jekyll as their SSG.

Add the _snippets_imports corresponding to your SSG:

cloudcannon.config.yaml
copied
_snippets_imports:
  jekyll: true
cloudcannon.config.json
copied
{
  "_snippets_imports": {
    "jekyll": true
  }
}
cloudcannon.config.yaml
copied
_snippets_imports:
  hugo:
    exclude:
      - hugo_instagram
cloudcannon.config.json
copied
{
  "_snippets_imports": {
    "hugo": {
      "exclude": [
        "hugo_instagram"
      ]
    }
  }
}

3. Configure path.static#

This step of the migration guide is only relevant to Sites using Hugo as their SSG.

CloudCannon no longer uses build integrations to set path.static automatically. Please set the path.static key to static.

cloudcannon.config.yaml
copied
paths:
  static: static
  uploads: static/uploads
cloudcannon.config.json
copied
{
  "paths": {
    "static": "static",
    "uploads": "static/uploads"
  }
}

To configure paths.uploads, you must also have configured paths.static first.

4. Configure your Markdown engine#

This step of the migration guide is only relevant to Sites using Jekyll or Hugo as their SSG.

CloudCannon supports two Markdown engines: CommonMark and Kramdown. Because most SSGs use CommonMark, CloudCannon assumes you are using this engine by default in the Unified Configuration file format.

Jekyll is on of the few SSGs which use Kramdown by default. If your Site uses Kramdown, you must specify your Markdown engine in your CloudCannon configuration file.

cloudcannon.config.yaml
copied
markdown:
  engine: kramdown
  options:
    treat_indentation_as_code: true
    table: true
    attributes: true
cloudcannon.config.json
copied
{
  "markdown": {
    "engine": "kramdown",
    "options": {
      "treat_indentation_as_code": true,
      "table": true,
      "attributes": true
    }
  }
}

Previously CloudCannon used your SSG configuration and build to infer which markdown.options you would want. With Unified Configuration, this needs to be configured explicitly. Below is a list of suggestions about options that you might want to enable.

  • For Hugo sites, check your Hugo config file
    • xhtml should match markup.goldmark.renderer.xhtml.
    • breaks should match markup.goldmark.renderer.hardWraps.
    • table should match markup.goldmark.extensions.table.
    • strikethrough should match markup.goldmark.extensions.strikethrough.
    • treat_indentation_as_code should be set to true
  • For Jekyll sites
    • breaks should match kramdown.hard_wrap from your Jekyll config file
    • treat_indentation_as_code should be set to true
    • table should be set to true
    • attributes should be set to true

5. Defunct configuration options#

CloudCannon no longer uses some configuration options in the Unified Configuration file format. Although leaving these keys in your Site files will not harm your Site, they also will not function. If you want to maintain a clean configuration file, we recommend removing defunct configuration options.

We recommend deleting the following keys:

  1. paths.data
  2. paths.collections
  3. paths.layouts
  4. paths.includes

Open in a new tab