Publish
Publishing a static website involves always two basic steps: Build & Deploy. There are many ways to realize them.
Many workflows for Hugo are listed in the section Hosting & Deployment of its documentation. In all cases we need to set the parameter baseURL
to our domain URL in the main configuration file config.yaml.
The following remarks should give you a first impression of two common concepts.
Use your own hardware
As long as you are the only one finalizing the content, it’s easy to stick to your own computer. To generate a complete version of the site, we use Hugo’s default build mode in the project root for example like this:
hugo --minify
Hugo renders the site, minifies the HTML and writes the files by default into the folder public. You can upload its content directly to your provider. That’s it. You may also transfer the files to a big provider with a Content Delivery Network (CDN) for worldwide minimal latency.
Automated Build and Continuous Deployment
Special providers automate the build process with configurable virtual containers. This is especially useful for teams in need of a reliable shared build environment. The provider gets access to the teams repository (usually Git based), automatically pulls new content and (re)builds the site or just a preview. Some of them also own a CDN, which they can populate immediately after every build.
This kind of setup may also be convenient for non-commercial projects and in a simplified form for private sites with only one author/editor. Some commercial providers offer a free tier for personal or open-source use. Hugo is building sites so fast, your project may well stay in their sometimes generous limits with several builds per day.
Caching resources between builds in a container is mandatory if we include many images and don’t want to waste energy and money on their repeated processing. Processed resources are always cached by Hugo. But we need to make sure that the caching folder is stored in our repository or enable another caching mechanism between runs in a container.