Build with Hugo
Create a Hugo site from an Azion template or with the Azion CLI, and deploy it to an Azion domain.
You can deploy a Hugo site on Azion from a template in Azion Console or with the Azion CLI. Both routes leave the site running on Azion and answering on an Azion domain.
Azion serves a Hugo site as a static application. The build writes the site to ./public, and the deploy uploads that folder to a storage bucket that an application serves. For the full list of frameworks Azion builds, refer to Frameworks compatibility.
Choose your route here. The prerequisites and the deploy procedure below change with it.
Prerequisites
- An Azion account. To create one, refer to Create an account.
- Access to Azion Console. To sign in, refer to How to access Azion Console.
- A GitHub account. The template form connects it when it asks for it.
Hugo templates
Azion deploys a Hugo template as a ready project. The Console route starts from one of these templates, and the CLI offers the same three:
| Template | Use |
|---|---|
| Hugo Boilerplate | Starter project |
| Influencer Hugo | Product showcase |
| Vex Hugo | Product landing page |
The Hugo Boilerplate has a guide of its own, linked in the table. Influencer Hugo and Vex Hugo share one guide: Deploy an E-commerce with Hugo Templates. For more information on templates, refer to Azion Marketplace.
Deploy the site
Both routes build the Hugo project and create the resources that serve it on Azion. Follow the panel of your route:
Run azion init with a project name. In the first picker, select Hugo; in the second, select a template:
With -y, the command installs the dependencies. With --auto, it does not ask about a local development server or a deploy. For the questions it asks without these options, refer to Azion CLI init. With the Hugo Boilerplate template, the output is:
The project lands in a my-site folder. Its azion.config.cjs sets the hugo preset and uploads ./public to a storage bucket that workloads can only read. For every setting in that file, refer to azion.config.js.
To build the site, run azion build from the project folder:
Azion Bundler runs the Hugo build with the hugo preset, using the Hugo copy the template installed, and the site lands in public:
To deploy the site, run azion deploy from the project folder:
The deploy uploads the project and opens the Console page that tracks it, and it prints that page’s URL in case no browser opens. At the end, it prints the URL of the site’s domain. For the full output and every flag, refer to Azion CLI deploy.
To preview the site on your machine first, refer to Azion CLI dev. For a Hugo project you already have, run azion link in its folder and select the Hugo preset, as Azion CLI link describes.
Check the site
The deploy gives you the URL of the site’s Azion domain, in the form https://xxxxxxxxxx.map.azionedge.net. The Console deploy page shows it, and azion deploy prints it on completion. Open that URL in a browser to see the Hugo site.
The first deploy can take several minutes to answer from every location; later deploys take about two minutes. A location that has not received the site yet answers with a 404 page that reads There's nothing here yet. If you get that page, wait and request the URL again.