There are a few static site generators out there, like Jekyll, Hugo, Gatsby, 11ty, Pelican, Hexo, Nikola, Metalsmith, Middleman, etc. I chose Zola to power this blog because it's simple, super speedy, easy to customise, and written in Rust.
Much of the frustration fun in running your own blog is the setup, so here's probably the quickest and dirtiest guide to getting a blog up and running with Zola and hosting it with Surge.
Prerequisites:
- A computer.
- Some command-line knowledge.
First, install Zola by running brew install zola
(if you have Homebrew installed) or by following the Zola install instructions here.
After installing Zola, create a new site with zola init myblog
, answer the install questions (we're using Surge so pick a base URL like: https://<subdomain>.surge.sh
, this can be changed later), and then cd myblog
.
Then choose a theme here and follow the install instructions. Mostly it's something like git init
and then git submodule add <theme url> themes/<theme name>
. For example:
git init git submodule add https://github.com/pawroman/zola-theme-terminimal.git themes/terminimal
Then add theme = "terminimal"
(or your theme name) to your config.toml
file and change any other relevant settings.
Create a Markdown .md
post in the content
directory like this. For example, content/2023-11-12-hello-world.md
:
+++
title = "Hello, World!"
date = 2023-11-13
[taxonomies]
tags = ["hello", "world"]
+++
Hello, World!
To preview locally run zola serve
and build your static site with zola build
To deploy, make sure Surge is installed with npm install --global surge
(assuming you have a recent version of Node.js) and then push your public
dir up using:
surge public <subdomain>.surge.sh
NOTE: Set your base_url
to in your config.toml
file, eg. base_url = "https://<subdomain>.surge.sh"
before you deploy.
You could also use Netlify or Github Pages or Cloudflare or whatever you want, but that's a topic for another day.
Anyway, that's it. Enjoy your static site!