Build with Hexo
Deploy a Hexo site to an Azion domain from the Hexo Boilerplate template, a GitHub repository, or the Azion CLI.
You can put a Hexo site on Azion three ways: deploy the Hexo template from Azion Console, import your own repository from GitHub, or run the Azion CLI. Each route leaves the site live on an Azion domain.
Azion serves a Hexo site as a static application. The Hexo build generates the site in ./public, and the deploy copies that folder to a storage bucket behind an application. To see which other frameworks Azion builds, refer to Frameworks compatibility.
Pick a route first. The prerequisites and the deploy steps on this page 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 during the deploy when it asks for one.
Hexo templates
The Console route deploys a template, a Hexo project that is ready to build. It starts from this template:
| Template | Use |
|---|---|
| Hexo Boilerplate | Single-page application |
Hexo Boilerplate has a guide of its own, linked in the table. For the template catalog, refer to Azion Marketplace. In the CLI route, the azion init template picker of the Hexo preset lists Hexo Boilerplate as its only entry.
Deploy the site
Every route builds the Hexo project and creates the Azion resources that serve it. Follow the panel for your route:
To create the project, run azion init with a project name. In the preset picker, select Hexo; in the template picker, select Hexo Boilerplate:
With -y, the command installs the dependencies. With --auto, it does not ask whether to start a local development server or deploy. For the questions it asks without these options, refer to Azion CLI init. The command prints:
The project is in the my-site folder. Its azion.config.cjs sets the hexo preset, and it uploads ./public to a storage bucket with read-only access for workloads. For the settings of that file, refer to azion.config.js.
To build the site, go to the project folder and run azion build:
Azion Bundler builds the project with the hexo preset, and Hexo writes the generated files to public. The template’s build script is hexo generate:
To deploy the site, run azion deploy from the project folder:
The deploy uploads the project and opens the Azion Console page that tracks it. If the browser does not open, use the URL of that page in the output. At the end, the command prints the URL of the site’s domain. For the full output and the deploy flags, refer to Azion CLI deploy.
To preview the site locally before a deploy, refer to Azion CLI dev. For a Hexo project you already have, run azion link in its folder and select the Hexo preset, as described in Azion CLI link.
Check the site
Each route gives you the URL of the site’s Azion domain, in the form https://xxxxxxxxxx.map.azionedge.net. In Azion Console, the deploy page shows it; in the CLI route, azion deploy prints it at the end. Open that URL in a browser to load the Hexo site.
The first deploy can take several minutes to answer from every location; later deploys take about two minutes. A location that does not have the site yet answers with a 404 page that reads There's nothing here yet. If you get that page, wait, then load the URL again.