I've decided to build my website using Zola. Zola is a static site generator written in Rust. My first foray into SSG was Gatsby. It came out about the sametime GraphQL did. Before Gatsby, GraphQL was this data fetching layer written by Facebook for solving problems like overfetching and growing pains of version api's. Nothing like solving problems a blog would never have, but nevertheless I bought in and started building. Gatsby was using GraphQL in novel new ways and that was really exciting. We could query our site metadata or site configurations and create fast websites that were pre-built templates in a few minutes. It was shiny and new and most importantly it wasn't Wordpress. At some point, we all have to come to the conclusion that Gatsby is beautiful, but a bit over the top for a blog. I want something fast and simple. I'm learning Rust so Zola was the natural next step and fit.
Deploying with Netlify
My old Gatsby site was deployed using Netlify, so I wanted to do the same for my new website built with Zola. Zola comes with instructions already for Netlify. You can also deploy using various other services you should check out here.
I found the instructions on Zola to be a little off. They make a reference to an image selection that as far as I can see doesn't exist. This screenshot shows what worked for this site.
We can also create a netlify.toml file in our root directory that Netlify will use when we push changes to our code.
[build] # This assumes that the Zola site is in a docs folder. If it isn't, you don't need # to have a `base` variable but you do need the `publish` and `command` variables. #base = "docs" publish = "public" command = "zola build" [build.environment] # Set the version name that you want to use and Netlify will automatically use it. ZOLA_VERSION = "0.13.0" # The magic for deploying previews of branches. # We need to override the base url with whatever url Netlify assigns to our # preview site. We do this using the Netlify environment variable # `$DEPLOY_PRIME_URL`. [context.deploy-preview] command = "zola build --base-url $DEPLOY_PRIME_URL"
My Zola Netlify build fails
I used the anpu theme for Zola. Unfortunately, as a result Netlify complained that it couldn't checkout the submodule. I needed to add a .gitmodule file to fix the build.
To fix it we just need to add a .gitmodules file to our root.
[submodule "themes/anpu"] path = themes/anpu url = https://github.com/zbrox/anpu-zola-theme.git