Using relative paths for DAM assets

Last modified: September 18th, 2024

You can choose one DAM to use relative paths on your site. This means that your DAM URLs may start with "/", instead of being fully qualified. A fully qualified URL is a complete Internet address and must include a hostname and top-level domain.

By default, all the URLs for assets on your DAM need to be fully qualified in order to preview them on CloudCannon. Similarly, CloudCannon will always save fully qualified URLs in your code when you upload an asset to a DAM through the CMS. This behaviour can be turned off by choosing to use relative paths for your DAM.

This option can be useful if your SSG prepends the DAM's base url during the build.

Using relative paths#

By default, relative paths in your site must refer to the site files.

If you choose to use relative paths with a DAM, you will not be able to browse assets from, or upload to, your site files in CloudCannon.

  1. In your site’s settings, navigate to Files/Assets
  2. Locate your DAM from the list, and click the three dots in the top right corner
  3. From the context menu, click Use Relative Paths
  4. Click the Confirm button

When changing this setting, you might need to rewrite existing URLs on the site to avoid broken previews in CloudCannon.

To undo this change, repeat the steps above but use the context menu on Site Files in the list.

Related Articles

Open in a new tab