Zola

What is Zola

Zola is a static site generator written in Rust. You write Markdown, run zola build, and get HTML. No server, no database, no backend.

Installation

# Windows
choco install zola
# macOS
brew install zola
# Linux
snap install --edge zola
zola --version

Project structure

my-blog/
├── config.toml      # Site settings
├── content/         # Posts (Markdown)
│   └── write/
│       └── post.md
├── templates/       # HTML layouts
├── sass/            # Styles
└── static/          # Images and static files

Create a new site

zola init my-blog
cd my-blog

Zola asks a few questions: URL, syntax highlighting, search. You can change all of that later in config.toml.

Write a post

Create content/write/post.md:

+++
title = "Post title"
date = 2025-12-07
+++

Write the content in Markdown.

The +++ block is metadata. Title is the heading, date is used for sorting.

Preview

zola serve

Open http://127.0.0.1:1111. Edit a file, save it, and the page refreshes automatically.

Important config

base_url = "https://yourdomain.com"
title = "Blog name"

compile_sass = true
minify_html = true

taxonomies = [
    {name = "tags", feed = true}
]

generate_feeds = true

Tags for posts

+++
title = "A post about Python"
date = 2025-12-07

[taxonomies]
tags = ["python", "programming"]
+++

Zola automatically creates /tags/python/, listing every post with that tag.

Deploy to Netlify

git init
git add .
git commit -m "Initial commit"
git push origin main

Netlify → Add new site → Import from Git:

  • Build command: zola build
  • Publish directory: public

Every push triggers a Netlify build and deploy. About 30 seconds from push to live.

Cost

  • Domain: ~$12/year
  • Hosting: $0 (Netlify free tier)
  • SSL: $0 (Let's Encrypt through Netlify)

Drafts

Put draft posts in content/write/drafts/. Add this to config:

ignored_content = ["*/drafts/*"]

Zola skips them during build. Move the file out of drafts when it is ready to publish.

Pagination

Add this to content/write/_index.md:

+++
paginate_by = 10
sort_by = "date"
+++

Zola automatically creates /write/page/2/, /write/page/3/, and so on.

Images

Put images in static/images/. Reference them in a post:

![Image description](/images/photo.jpg)

Use / at the beginning. Without it, images can break on nested pages.

Workflow recap

# Write a new post
touch content/write/new-post.md

# Preview while writing
zola serve

# Push when done
git add .
git commit -m "Add new post"
git push

Push → Netlify build → Live. That is the whole workflow.

Zola là gì

Static site generator viết bằng Rust. Viết Markdown, chạy zola build, ra HTML. Không cần server, không cần database, không cần backend.

Cài đặt

# Windows
choco install zola
# macOS
brew install zola
# Linux
snap install --edge zola
zola --version

Cấu trúc project

my-blog/
├── config.toml      # Cài đặt site
├── content/         # Bài viết (Markdown)
│   └── write/
│       └── bai-viet.md
├── templates/       # HTML layout
├── sass/            # Style
└── static/          # Ảnh, file tĩnh

Tạo site mới

zola init my-blog
cd my-blog

Hỏi vài câu: URL, syntax highlighting, search. Có thể đổi sau trong config.toml.

Viết bài

Tạo file content/write/bai-viet.md:

+++
title = "Tiêu đề bài viết"
date = 2025-12-07
+++

Nội dung viết bằng Markdown.

Phần +++ là metadata. Title là heading, date dùng để sắp xếp.

Preview

zola serve

Mở http://127.0.0.1:1111. Sửa file, lưu, trang tự refresh.

Config quan trọng

base_url = "https://yourdomain.com"
title = "Tên blog"

compile_sass = true
minify_html = true

taxonomies = [
    {name = "tags", feed = true}
]

generate_feeds = true

Tag cho bài viết

+++
title = "Bài về Python"
date = 2025-12-07

[taxonomies]
tags = ["python", "programming"]
+++

Zola tự tạo trang /tags/python/ hiện tất cả bài có tag đó.

Deploy lên Netlify

git init
git add .
git commit -m "Initial commit"
git push origin main

Netlify → Add new site → Import from Git:

  • Build command: zola build
  • Publish directory: public

Mỗi lần push, Netlify tự build và deploy. 30 giây từ push đến live.

Chi phí

  • Domain: ~$12/năm
  • Hosting: $0 (Netlify free tier)
  • SSL: $0 (Let's Encrypt qua Netlify)

Draft

Đặt bài nháp vào content/write/drafts/. Thêm vào config:

ignored_content = ["*/drafts/*"]

Zola bỏ qua khi build. Chuyển file ra khỏi drafts khi sẵn sàng publish.

Phân trang

Thêm vào content/write/_index.md:

+++
paginate_by = 10
sort_by = "date"
+++

Tự tạo /write/page/2/, /write/page/3/, v.v.

Ảnh

Đặt vào static/images/. Tham chiếu trong bài:

![Mô tả ảnh](/images/photo.jpg)

Dùng / ở đầu. Không có / ảnh sẽ hỏng ở các trang khác.

Workflow tổng kết

# Viết bài mới
touch content/write/bai-moi.md

# Preview khi viết
zola serve

# Xong thì push
git add .
git commit -m "Thêm bài mới"
git push

Push → Netlify build → Live. Đó là toàn bộ workflow.