HugoBlog

hugo-themes-zhi — Hugo Blog Template

By mickeyzzc

Zhi is a minimal Hugo blog theme supporting dark/light mode, MathJax formulas, Mermaid diagrams, image lightbox, and code copy. All assets are processed through Hugo Pipes, with no need for external build tools such as webpack or Vite.

Explore the design

Compare the page layouts and mobile experience. Open any screenshot for a closer look.

3 previews
Desktop homepage1 / 3
Desktop captureTop of page

Actual screenshot captured by the server browser.

All pages & views 3

Screenshots show visual appearance; interactive behavior may differ.

Recorded 2026-09-30View source

What stands out

A quick read of the recorded project description.

01

Dark/light theme switching with system preference detection and localStorage memory

02

MathJax and Mermaid load automatically on demand; Mermaid supports v11+ extended node shapes, classDef, and ELK layout

03

Code blocks with language labels and copy buttons, using Hugo's built-in Chroma highlighting

04

Bilibili/YouTube video shortcodes with automatic platform switching based on visitor time zone and manual switching

05

CSS/JS all processed through Hugo Pipes (resources.Get → minify → fingerprint), with no need for webpack/vite

06

Built-in page templates for series taxonomy, multilingual switching, archives, friend links, and tag clouds

Template Details

Zhi is a blog theme for Hugo sites, positioned as a minimal style with a maximum content width of 768px and a mobile-first responsive layout. The theme enables features on demand through configuration options: code highlighting, MathJax math formulas, Mermaid diagrams, dark/light switching, image lightbox, custom analytics, and series taxonomy. MathJax and Mermaid load automatically when corresponding markup appears in page content; Mermaid supports v11+ extended node shapes, classDef styles, and ELK layout. Video shortcodes can embed Bilibili or YouTube; when IDs for both platforms are provided, the playback source is selected automatically based on the visitor's time zone, and manual switching is also allowed. The theme includes built-in multilingual switching and translation links, step-style layout and sort switching for series posts, as well as page templates for archives, friend links, and tag clouds. Styles and scripts are all processed through Hugo Pipes' resources.Get, minify, and fingerprint pipeline, with no dependency on webpack/vite; theme colors are defined as CSS custom properties and can be overridden in the site's own CSS. It requires Hugo 0.146.0 or later, and the non-extended version also works. The repository provides bilingual Chinese and English documentation covering features, content, and configuration. The demo site is www.mickeyzzc.tech.

HugoBlog

Is it right for your project?

Use Cases

  • Building a personal technical blog with Hugo and writing long-form posts containing formulas or flowcharts
  • Embedding Bilibili or YouTube videos for both domestic and overseas readers
  • Maintaining a multilingual blog and wanting automatic translation page association between languages
  • Organizing posts into series and needing step-style navigation and sort switching

Suitable For

  • Bloggers using Hugo 0.146.0 or later who prefer a minimal reading layout
  • Sites that want to avoid a Node build chain and handle assets only with Hugo's own toolchain
  • Technical writing scenarios requiring math formulas, Mermaid diagrams, and code highlighting
  • Sites needing dark mode, image lightbox, and multilingual support

Getting started & customization

Use these recorded setup notes alongside the repository instructions for your chosen version.

  1. 1

    Requires Hugo ≥ 0.146.0; the non-extended version also works

  2. 2

    Recommended to import github.com/mickeyzzc/hugo-theme-zhi as a Hugo Module; alternatively git clone into themes/zhi and set theme = 'zhi'

  3. 3

    Enable switches such as codeHighlight, mathJax, mermaid, themeSwitch, lightbox, analytics, and series as needed under [params.features] in hugo.toml

  4. 4

    The series feature requires configuring series = "series" under [taxonomies]

  5. 5

    Theme colors can be overridden in the site's own CSS via the CSS variables defined in assets/css/components/theme.css

Read repository instructions

License & source material

Usage conditions & limitations

Free to use · keep license notice

This entry covers the free version under the MIT license in the public repository; the free scope is the code of that version and does not mean external services or third-party assets are free.

Must comply with when using

  • Free use, modification, commercial use, and distribution of this version's code are permitted.
  • When distributing copies or substantial portions of the code, retain the original author's copyright notice and the full MIT license notice.
  • The code is provided as is; warranties and limitations of liability are governed by the original license and applicable law.

Additional costs & items to verify

  • Demo images, fonts, icons, and other third-party assets must be checked against their respective licenses and cannot be judged solely by the code's MIT license.
  • External services such as domains, hosting, databases, payments, or AI may incur separate charges.
View Original Text Basis

Compiled by DeepSeek based on repository license and README ·2026-10-01. Results only cover the materials read; dependencies, images, fonts, and subsequent term changes are subject to their respective original texts.

Project checks & description sources

Template Information

Source platforms
GitHub
Documentation and maintenance reference score
More documented · 80 / 100
Technologies
Hugo
Website type
Blog
How this score is calculated

Our heuristic uses license records (up to 30), a demo link (12), a preview (10), stars (15), recorded maintenance (15), description completeness (8), feature records (5) and classification data (5). It is not a code, security or performance test, or a Google score. A link does not establish tested functionality.

What to verify for this project

Repository update recorded
2026-09-23
Screenshot last checked
2026-10-01

A demo link is listed. Check it with your own content and viewport sizes; its presence does not confirm that forms, authentication or payments work.

The catalog identifies Hugo as the primary stack. Check the actual dependency manifest and lockfile for versions and hosting requirements. These notes use recorded metadata, not a code audit or a deployment test.

Use a selection guide →

How this description was prepared

AI-assisted description based on catalog records and repository material. Repository authors are not automatically the reviewers of this description.

Automatically checked against source and license rules; no manual editorial review.

Inspect the recorded source material

SHA-256: a54bf74d83777c25b22a79b0b66772fe64172094e748b12e05156c22ab88d230

2026-10-01T14:20:39.520Z

Source file / repository
[**English**](README.md) | [中文](README.zh.md)

# Zhi

A minimal Hugo blog theme with dark/light mode, MathJax, Mermaid diagrams, Bilibili/YouTube video shortcodes, image lightbox, and code copy — built with pure Hugo Pipes, zero external build tools.

![Hugo](https://img.shields.io/badge/Hugo-Extended%20%E2%89%A50.146.0-blue?logo=hugo&logoColor=white) ![License: MIT](https://img.shields.io/github/license/mickeyzzc/hugo-themes-zhi?color=green) ![Release](https://img.shields.io/github/v/release/mickeyzzc/hugo-themes-zhi) ![Stars](https://img.shields.io/github/stars/mickeyzzc/hugo-themes-zhi?style=social) ![Last Commit](https://img.shields.io/github/last-commit/mickeyzzc/hugo-themes-zhi?color=orange) ![Repo Size](https://img.shields.io/github/repo-size/mickeyzzc/hugo-themes-zhi?color=lightgray)

## Features

- **Dark / Light Theme** — Toggle with system preference detection and `localStorage` persistence → [docs](docs/en/features.md#theme-switch)
- **Syntax Highlighting** — Hugo's built-in Chroma with copy button and language label → [docs](docs/en/content.md#code-highlight)
- **MathJax 3** — Auto-loaded when `$...$` or `$$...$$` detected in page content → [docs](docs/en/content.md#mathjax)
- **Mermaid v11+ Diagrams** — Auto-loaded when ` ```mermaid ` code blocks exist; supports expanded node shapes (`@{ shape: ... }`), `classDef` styling, ELK layout, architecture/kanban diagrams; theme-aware (dark/light) → [docs](docs/en/content.md#mermaid)
- **Video Shortcode** — Embed Bilibili or YouTube with automatic geo-switching (timezone-based) and manual toggle → [docs](docs/en/content.md#video)
- **Image Lightbox** — Click any article image to view full-size overlay → [docs](docs/en/features.md#image-lightbox)
- **Responsive Design** — Mobile-first, max-width `768px` content area
- **Custom Analytics** — Configurable endpoint with sampling support → [docs](docs/en/configuration.md#analytics)
- **Hugo Pipes** — All CSS/JS processed via `resources.Get` → `minify` → `fingerprint`, no webpack/vite
- **Multilingual / i18n** — Language switcher with automatic translation linking → [docs](docs/en/features.md#language-switcher)
- **Series Taxonomy** — Post series with stepper layout, sort toggle, and weight-based ordering → [docs](docs/en/features.md#series)

## Requirements

- Hugo **≥ 0.146.0** (non-extended is fine)

## Quick Start

### As a Hugo Theme Module (recommended)

In your site's `hugo.toml`:

```toml
[module]
  [[module.imports]]
    path = "github.com/mickeyzzc/hugo-theme-zhi"
```

### As a Git Clone

```bash
git clone https://github.com/mickeyzzc/hugo-theme-zhi.git themes/zhi
```

Then in your site's `hugo.toml`:

```toml
theme = 'zhi'
```

## Configuration

```toml
[params.features]
  codeHighlight = true   # Syntax highlighting
  mathJax       = true   # Math rendering ($...$, $$...$$)
  mermaid       = true   # Mermaid diagrams
  themeSwitch   = true   # Dark/light toggle button
  lightbox      = true   # Click-to-zoom images
  analytics     = true   # Custom analytics endpoint
  series       = true   # Post series with sort toggle
[params.analytics]
  provider   = "custom"
  endpoint   = "/metrics"
  siteId     = ""
  sampleRate = 100

[params.video]
  defaultPlatform = "bilibili"   # "bilibili" or "youtube"
  showSwitch      = true         # Show platform toggle button

[params.theme]
  default = "auto"   # "auto", "light", or "dark"
}

[taxonomies]
  series = "series"
```

## Documentation

Comprehensive bilingual documentation for all features:

| Category | English | 中文 |
|----------|---------|------|
| Features | [docs](docs/en/features.md) | [文档](docs/zh-cn/features.md) |
| Content | [docs](docs/en/content.md) | [文档](docs/zh-cn/content.md) |
| Configuration | [docs](docs/en/configuration.md) | [文档](docs/zh-cn/configuration.md) |

## Usage

> For complete documentation, see [Documentation](#documentation).

{{</* video bilibili="BV1xx411c7mD" youtube="dQw4w9WgXcQ" title="Demo Video" */>}}
```

Embed Bilibili and/or YouTube videos. When both IDs are provided, the player auto-selects based on timezone (China → Bilibili, else → config default). Users can manually switch platforms.

### Mermaid Diagrams (v11+)

Use a fenced code block with the `mermaid` language. Supports all Mermaid v11+ features including expanded node shapes and `classDef` styling:

~~~markdown
```mermaid
graph TD
    A@{ shape: doc, label: "Document" } --> B@{ shape: diam, label: "Decision" }
    B -->|Yes| C@{ shape: hex, label: "Process" }
    B -->|No| D@{ shape: cyl, label: "Database" }

    classDef primary fill:#e1f5fe,stroke:#0288d1
    classDef warn fill:#fff3e0,stroke:#ef6c00
    class A,C primary
    class B,D warn
```
~~~

Supported diagram types: `flowchart`, `sequence`, `class`, `state`, `ER`, `gantt`, `pie`, `mindmap`, `timeline`, `gitgraph`, `architecture` (v11.1+), `kanban` (v11.0+), and more.

### Math / LaTeX

Inline: `$E = mc^2$`

Display:
```markdown
$$
\int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi}
$$
```

### Code Blocks

All fenced code blocks automatically get:
- Language label (top-left)
- Copy button (top-right)
- Hugo Chroma syntax highlighting

```markdown
```python
def hello():
    print("Hello, World!")
```
```

### Menus

```toml
[[menus.main]]
  name = 'Home'
  pageRef = '/'
  weight = 10

[[menus.main]]
  name = 'Posts'
  pageRef = '/posts'
  weight = 20

[[menus.main]]
  name = 'Series'
  pageRef = '/series'
  weight = 30
```

### Social Links

```toml
[[params.social]]
  name = "GitHub"
  url = "https://github.com/yourusername"

[[params.social]]
  name = "Twitter"
  url = "https://twitter.com/yourusername"
```

## Project Structure

```
layouts/
├── _default/          # baseof.html, single.html, list.html, _markup/
├── _partials/         # Hugo 0.120+ partials (head, header, footer, menu, terms, lang-switch, greeting, tag-cloud)
├── partials/          # Legacy (mathjax.html, mermaid.html)
├── shortcodes/        # video.html
├── archives/           # Archives page
├── flinks/             # Friend links page
├── series/             # Series taxonomy pages
├── home.html, section.html, taxonomy.html, term.html

assets/
├── css/
│   ├── main.css               # Aggregator via @import
│   └── components/            # Per-feature CSS modules
│       ├── theme.css          # CSS variables (light + dark)
│       ├── header.css
│       ├── footer.css
│       ├── code.css
│       ├── video.css
│       ├── lightbox.css
│       ├── mermaid.css
│       ├── math.css
│       ├── lang-switch.css
│       ├── series.css
│       ├── greeting.css
│       └── tag-cloud.css
└── js/
    ├── main.js               # Orchestrator (MathJax + Mermaid lazy-load)
    ├── code-copy.js           # Copy button for code blocks
    ├── theme-toggle.js        # Dark/light toggle with persistence
    ├── video-geo-switch.js    # Bilibili/YouTube geo-switching
    ├── lightbox.js            # Image lightbox overlay
    ├── sidebar.js
    ├── greeting.js
    ├── search.js
    ├── toc.js
    ├── reading-progress.js
    ├── back-to-top.js
    ├── donation.js
    ├── analytics.js
    └── series-sort.js
```

## Development

```bash
# Start dev server with live reload
hugo server

# Production build
hugo --minify

# Run E2E tests
npx playwright test
```

## Theme System

Theme colors are defined as CSS custom properties in `assets/css/components/theme.css`:

```css
:root {
  --bg: #ffffff;
  --text: #222222;
  --accent: #0066cc;
  /* ... */
}

[data-theme="dark"] {
  --bg: #1a1a1a;
  --text: #e0e0e0;
  --accent: #4da6ff;
  /* ... */
}
```

Override these variables in your site's own CSS to customize colors.

## License

MIT
Report a correction

Explore similar templates

Compare previews and descriptions within the same stack and category.