Introduction

Learn how to connect Hugo Modules to your CloudCannon site.

Welcome to the Hugo Modules guide. If you want to use themes and components from other repositories on your site, you are in the right place! To configure CloudCannon so that your Hugo modules install correctly, you must customize how CloudCannon loads your modules into your build.

This guide assumes you already have a Hugo site on CloudCannon and are using GitHub as your module repository.

Hugo Modules can use public or private repositories.

For a public repository, you won't require any configuration in CloudCannon to build successfully. However, you might want to improve your experience by using CloudCannon's Site Mounting feature. With Site Mounting, a new build of your site is triggered every time the Hugo Module is updated.

For a private repository, you must give CloudCannon permission to access the repository at build time. There are two approaches for connecting a private repository.

If you have a simple module setup, such as a theme module containing layouts and components, you can emulate Hugo Modules using Site Mounting instead. With Site Mounting, your sites can benefit from CloudCannon's authenticated connection with your git provider, and you can trigger a build of your site every time the Hugo module is updated.

If you have a more complex setup, such as if your module has nested modules, replicating this with Site Mounting can become more difficult. In this case, we recommend using a GitHub access token to give your build permission to download your modules.

This guide will cover how to set up your site using Site Mounting in CloudCannon or a GitHub access token.

Open in a new tab