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 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:
    xhtml: false
    breaks: false
    linkify: false
    typographer: false
    quotes: 
    spaced_lists: false
    sentence_per_line: false
    gfm: false
    code_block_fences: '```'
    escape_snippets_in_code_blocks: false
    treat_indentation_as_code: false
    table: false
    strikethrough: false
    subscript: false
    superscript: false
    heading_ids: false
    attributes: false
    attribute_elements: 
cloudcannon.config.json
copied
{
  "markdown": {
    "engine": "kramdown",
    "options": {
      "xhtml": false,
      "breaks": false,
      "linkify": false,
      "typographer": false,
      "quotes": null,
      "spaced_lists": false,
      "sentence_per_line": false,
      "gfm": false,
      "code_block_fences": "```",
      "escape_snippets_in_code_blocks": false,
      "treat_indentation_as_code": false,
      "table": false,
      "strikethrough": false,
      "subscript": false,
      "superscript": false,
      "heading_ids": false,
      "attributes": false,
      "attribute_elements": null
    }
  }
}

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