Zola
Zola ↗ is a fast static site generator in a single binary with everything built-in. In this guide, you will create a new Zola application and deploy it using Cloudflare Pages. You will use the zola
CLI to create a new Zola site.
First, install ↗ the zola
CLI, using the specific instructions for your operating system below:
If you use the package manager Homebrew ↗, run the brew install
command in your terminal to install Zola:
If you use the package manager Chocolatey ↗, run the choco install
command in your terminal to install Zola:
If you use the package manager Scoop ↗, run the scoop install
command in your terminal to install Zola:
Your Linux distro’s package manager may include Zola. If this is the case, you can install it directly using your distro’s package manager — for example, using pkg
, run the following command in your terminal:
If your package manager does not include Zola or you would like to download a release directly, refer to the Manual section below.
The Zola GitHub repository contains pre-built versions of the Zola command-line tool for various operating systems, which can be found on the Releases page ↗.
For more instruction on installing these releases, refer to Zola’s install guide ↗.
With Zola installed, create a new project by running the zola init
command in your terminal using the default template:
Upon running zola init
, you will prompted with three questions:
-
What is the URL of your site? (https://example.com ↗): You can leave this one blank for now.
-
Do you want to enable Sass compilation? [Y/n]: Y
-
Do you want to enable syntax highlighting? [y/N]: y
-
Do you want to build a search index of the content? [y/N]: y
All of the framework guides assume you already have a fundamental understanding of Git ↗. If you are new to Git, refer to this summarized Git handbook ↗ on how to set up Git on your local machine.
If you clone with SSH, you must generate SSH keys ↗ on each computer you use to push or pull from GitHub.
Refer to the GitHub documentation ↗ and Git documentation ↗ for more information.
Create a new GitHub repository by visiting repo.new ↗. After creating a new repository, go to your newly created project directory to prepare and push your local application to GitHub by running the following commands in your terminal:
To deploy your site to Pages:
- Log in to the Cloudflare dashboard ↗ and select your account.
- In Account Home, select Workers & Pages > Create application > Pages > Connect to Git.
- Select the new GitHub repository that you created and, in the Set up builds and deployments section, provide the following information:
Configuration option | Value |
---|---|
Production branch | main |
Build command | zola build |
Build directory | public |
Below the configuration, make sure to set the Environment Variables (advanced) for specifying the ZOLA_VERSION
.
For example, ZOLA_VERSION
: 0.17.2
.
After configuring your site, you can begin your first deploy. You should see Cloudflare Pages installing zola
, your project dependencies, and building your site, before deploying it.
After deploying your site, you will receive a unique subdomain for your project on *.pages.dev
.
You can now add that subdomain as the base_url
in your config.toml
file.
For example:
Every time you commit new code to your Zola site, Cloudflare Pages will automatically rebuild your project and deploy it. You will also get access to preview deployments on new pull requests, so you can preview how changes look to your site before deploying them to production.
By completing this guide, you have successfully deployed your Zola site to Cloudflare Pages. To get started with other frameworks, refer to the list of Framework guides.