Defining more ways to add new files

Create or change actions for the add dropdown menu in the collection list with _add_options.

_add_options are an array of objects that extend the functionality of the Add button in a collection. They are added to your CloudCannon collection configuration. Learn more about defining collections in CloudCannon.


Add options can include actions on the current collection, other collections, and external links.


Some example configurations are shown below:

These options are set in _config.yml on the cloudcannon.collections level. For example:

        - name: Add Post
          href: "cloudcannon::editor/:collections_dir/:base_path/.:extension🆕"
        - name: Add Draft
          href: "cloudcannon::editor/:collections_dir/:base_path_draftify/.:extension🆕:base_path_postify/_defaults.:extension"

Extended example:

        - name: Add Staff Member
          href: "cloudcannon:explore/_staff/.md🆕"
        - name: Add Author
          icon: edit
          href: "cloudcannon:explore/_staff/.md🆕/_staff/"
        - name: Add Office
          href: "cloudcannon:explore/_offices/.md🆕"
        - name: Add Office Location
          icon: public
          href: "cloudcannon:explore/_data/office-locations.yml"
        - name: Search on Google
          icon: search
          href: ""

For the offices collection, this will result in the following menu:

Screenshot of a collection with add options configured


_add_options are configured using the following keys:

name - String

The text displayed for the menu item.

icon - String

The icon next to the text in the menu item. Must match a Material Icon name.

href - String

The link that opens when the option is clicked.

The href field is can be an external link, but it can also be formatted as an Editor Link. Editor Links must begin with cloudcannon:. There are a number of variables you can use to make these links more flexible:


Usually explore, is update if creating an HTML file.


The collections path from the build information.


The path the editor is currently navigated to, not including the source or :collections_dir.


Same as :base_path, with /_drafts/ changed to /_posts/.


Same as :base_path, with /_posts/ changed to /_drafts/.


The source path defined your site config.


The extension of the default content file, not prefixed with ..


Signifies that a new file will be created. To specify a file to use as a template, declare the path to the file after the 🆕 emoji. This path may also use the parameters specified above.

You can also explicitly declare these variables (e.g. use explore instead of :editor).


If no default content file is specified after 🆕, CloudCannon will use the Collection Defaults file. If no defaults file exists, CloudCannon will use an existing file in the collection as a template.

Was this article helpful? or Suggest an improvement >

Related articles

Other Resources

  1. Material Icons