Hugo博客

hugo-antfustyle-theme — Hugo 博客模板

作者 youtzz

hugo-antfustyle-theme 是一个把 antfu.me 视觉风格移植到 Hugo 的极简博客主题,采用打字机字体、按年份归档的文章列表与 ArtPlum/ArtDots 页面装饰。

看看你的网站会是什么样

浏览真实页面截图,比较内容排版与手机效果。点击下方缩略图切换,放大查看整页细节。

2 个预览视图
桌面端首页1 / 2
桌面端截图首屏预览

由服务器浏览器实际访问页面后截取。

全部页面与视图 2

截图用于了解视觉与布局,交互效果请以实际项目为准。

采集于 2026-09-30查看来源

值得关注的模板亮点

从已有项目资料中,快速了解它的特点。

01

首页显示最近文章,归档页按年份分组并带大号年份水印

02

打字机字体仅使用系统回退链,不引入 CDN

03

纸白 #FAFAF7 配炭黑 #1A1A1A 的印刷感配色,链接继承正文颜色

04

自动深色模式,含日/月切换与 localStorage 记忆

05

ArtPlum / ArtDots 页面装饰通过 [params.art] 注册表配置,支持 active、pool、random 与 extra 自定义

06

默认页脚署名行可用 themeCredit = false 关闭

模板详细介绍

这是一个面向 Hugo 的极简博客主题,把 antfu.me 的视觉语言移植到 Hugo 模板体系中,作者明确说明是克制移植而非功能堆料。首页展示最近文章,归档页按年份分组并带大号年份水印;正文使用系统回退的打字机字体(JetBrains Mono → IBM Plex Mono → SF Mono → Menlo),不依赖 CDN;配色为纸白 #FAFAF7 与炭黑 #1A1A1A,链接继承正文颜色。主题自带 prefers-color-scheme 自动深色模式,并提供日/月切换与 localStorage 记忆。页面装饰通过 [params.art] 注册表配置,内置 plum 与 dots 两种,支持 active、pool 与 random,也可用 extra 挂载自定义脚本;在 prefers-reduced-motion: reduce 下不挂载也不下载脚本。默认品牌标记是醒石风格的「石」字 logo,可通过 layouts/partials/brand-logo.html 钩子替换。此外包含 * * * 星号分隔符、隐藏导航/评论/页脚的打印样式表,以及默认开启、可用 themeCredit = false 关闭的页脚署名行。主题要求 Hugo ≥ 0.164.0,不需要 Extended 版本(纯 CSS 加 minify/fingerprint,不使用 Sass)。仓库目前采用滚动 main 分支,没有发布标签,需要固定版本时可锁定提交 SHA。

Hugo博客

适合你的项目吗?

适用场景

  • 搭建以文字为主的个人技术博客
  • 需要按年份浏览历史文章的写作归档站点
  • 偏好打字机/印刷视觉风格、不想要复杂组件的站点
  • 希望通过项目级 partial 钩子替换 logo、页脚或插入评论的定制需求

适合人群

  • 使用 Hugo 并接受 Hugo ≥ 0.164.0 的站点
  • 不需要 Hugo Extended、只用纯 CSS 构建的项目
  • 愿意通过 hugo.toml 的 [params] 与项目级 partial 钩子做配置的开发者
  • 以文章列表和归档为主要浏览入口的博客

上手与定制指南

结合仓库当前版本的说明,按下面的资料检查内容、配置与运行要求。

  1. 1

    需要 Hugo ≥ 0.164.0,开发环境约为 0.166.x,theme.toml 中声明了 min_version;不需要 Extended 版本。

  2. 2

    安装方式二选一:在已是 git 仓库的站点根目录执行 git submodule add,或直接 git clone 到 themes/hugo-antfustyle-theme。

  3. 3

    在 hugo.toml 中设置 theme = "hugo-antfustyle-theme",并通过 [params] 配置 description、homeIntro、homeGroups 等字段。

  4. 4

    仓库采用滚动 main 分支、暂无发布标签,需要固定版本时锁定提交 SHA;更新子模块时建议用 pull --ff-only 而非 submodule update --remote。

  5. 5

    演示图片、字体、图标等第三方素材需按各自许可核对;antfu.me 的品牌标记与页面内容不因代码 MIT 许可而可商用。

查看仓库使用说明

授权与来源资料

使用条件与限制

免费使用 · 保留许可声明

本次收录的是公开仓库中采用 MIT 许可的免费版本;免费范围为该版本代码,不代表外部服务或第三方素材免费。

使用时需要遵守

  • 允许免费使用、修改、商用和分发该版本代码。
  • 分发代码副本或实质性部分时,保留原作者版权声明和完整 MIT 许可声明。
  • 代码按现状提供;担保与责任限制以原许可证及适用法律为准。

额外费用与待核对事项

  • antfu.me 的品牌标记、图片与页面内容版权归 Anthony 所有,不因站点代码采用 MIT 许可而可自由商用;如需使用这些素材须另行获得授权。
  • 默认品牌标记为醒石风格「石」字 logo,若需替换须通过 layouts/partials/brand-logo.html 钩子自行覆盖。
  • 仓库暂无发布标签,采用滚动 main 分支;需要固定版本时须自行锁定提交 SHA。
  • 演示图片、字体、图标及其他第三方素材需按各自许可核对,不能仅凭代码的 MIT 许可判断。
  • 域名、托管、数据库、支付或 AI 等外部服务可能另外收费。
查看原文依据

Permission is hereby granted, free of charge

许可证原文

antfu.me’s **brand marks, images, and page content** remain under Anthony’s own rights; do not treat them as free for commercial reuse just because its site code is MIT.

README 原文

Sites can swap the logo via the `layouts/partials/brand-logo.html` hook

README 原文

This theme follows a **rolling `main`** model for now (no release tags yet).

README 原文
https://github.com/youtzz/hugo-antfustyle-theme/blob/main/LICENSEhttps://github.com/youtzz/hugo-antfustyle-theme/blob/main/README.md

DeepSeek 根据仓库许可证和 README 整理 ·2026-10-01。结果仅覆盖已读取资料,依赖、图片、字体及后续条款变更以各自原文为准。

项目核对记录与介绍依据

模板资料

来源平台
GitHub
资料与维护参考分
资料较完整 · 80 / 100
技术栈
Hugo
网站类型
博客
这个分数如何计算

本站按许可资料(最高30分)、演示链接(12分)、预览图(10分)、Star数(15分)、记录的维护时间(15分)、描述完整度(8分)、功能记录(5分)和分类资料(5分)计算。它不是代码、安全或性能测试,也不是 Google 评分;有链接不代表已实测可用。

这个项目需要核对什么

记录的仓库更新时间
2026-09-24
截图检查日期
2026-10-01

已收录演示链接。请用你的内容与屏幕尺寸检查;有演示不代表表单、认证或支付已经可用。

目录记录的主要技术栈是 Hugo。请通过依赖清单和锁文件核对实际版本与托管要求。这些说明基于收录资料,不代表代码审计或部署实测。

查看具体选型方法 →

介绍的制作与核对状态

介绍由 AI 辅助整理目录与仓库资料。仓库作者不等于这篇介绍的审核者。

已完成服务器许可规则与 AI 来源核对;未经过人工编辑审核。

查看当时使用的来源资料

SHA-256: a8c7dc2eb44e583ebcbbb67cc9d915dbb095854e99f7656732e0823ce54501db

2026-10-01T14:21:32.944Z

来源文件 / 仓库
# hugo-antfustyle-theme

[![Demo](https://img.shields.io/badge/demo-GitHub%20Pages-blue?logo=github)](https://youtzz.github.io/hugo-antfustyle-theme/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)

A **minimal** Hugo port of [antfu.me](https://antfu.me/) visuals — restrained typewriter / print aesthetic, not a kitchen-sink theme.

> 复古打字机 / 印刷感 / 工程师低调美学。克制移植,不为功能堆料。

| | |
| --- | --- |
| **Demo** | [youtzz.github.io/hugo-antfustyle-theme](https://youtzz.github.io/hugo-antfustyle-theme/) |
| **Real use / In production** | [keiwake.com](https://keiwake.com) |

## Features

- **Compact text lists** — home shows recent posts; archive groups by year (large year watermark)
- **Typewriter fonts** — system fallbacks only (JetBrains Mono → IBM Plex Mono → SF Mono → Menlo); no CDN
- **Print-like palette** — off-white `#FAFAF7` paper + charcoal `#1A1A1A` text; links inherit text color
- **Auto dark mode** — `prefers-color-scheme` + sun/moon toggle + `localStorage`
- **ArtPlum / ArtDots** — `[params.art]` registry + `active` / `pool` (extend via `extra`); respects `prefers-reduced-motion`
- **Awakestone-style「石」logo** — default brand mark (醒石 / Awakestone); replace via documented project override
- **Star dividers `* * *`** — antfu-style section breaks
- **Print stylesheet** — hides nav / comments / footer; appends URLs to external links
- **Theme credit** — footer defaults to a muted “Powered by Hugo Antfustyle Theme” line (disable via `themeCredit = false`)

## Quick Start (from zero)

Copy-paste path for an empty directory. You do **not** need this repo’s `exampleSite` to get a running site.

**Requirements:** Hugo ≥ `0.164.0` (developed against ~0.166.x; `theme.toml` `min_version`). Plain Hugo is enough — **Extended is not required** (plain CSS + minify/fingerprint, no Sass). Install from [gohugo.io](https://gohugo.io/installation/).

### 1. Create a site

```bash
hugo new site my-blog
cd my-blog
```

### 2. Add the theme (pick one)

**A. Git submodule** — the site directory must already be a git repo (`git submodule` fails with `fatal: not a git repository` otherwise):

```bash
git init
git submodule add https://github.com/youtzz/hugo-antfustyle-theme.git themes/hugo-antfustyle-theme
```

**B. Plain clone** (no git required in the site root):

```bash
mkdir -p themes
git clone https://github.com/youtzz/hugo-antfustyle-theme.git themes/hugo-antfustyle-theme
```

### 3. Minimal `hugo.toml`

Create or replace `hugo.toml` in the site root:

```toml
baseURL = "http://localhost:1313/"
title = "My Blog"
theme = "hugo-antfustyle-theme"

[params]
  description = "A short subtitle"

[[menus.main]]
  name = "Posts"
  url = "/posts/"
  weight = 10
```

### 4. First published post

```bash
hugo new content posts/hello.md
```

Edit `content/posts/hello.md` so it is **not** a draft (remove `draft: true`, or set `draft: false`), for example:

```markdown
---
title: "Hello"
date: 2026-09-22
draft: false
---

First post with **hugo-antfustyle-theme**.
```

### 5. Run & build

```bash
hugo server
# open http://localhost:1313/

hugo --minify
# success: site written under public/ with no errors
```

To preview drafts instead of publishing: `hugo server -D`.

### Already have a Hugo site?

```bash
# Clone into themes/
mkdir -p themes
git clone https://github.com/youtzz/hugo-antfustyle-theme.git themes/hugo-antfustyle-theme
# or, from a git-managed site root:
# git submodule add https://github.com/youtzz/hugo-antfustyle-theme.git themes/hugo-antfustyle-theme

# Enable in hugo.toml
echo 'theme = "hugo-antfustyle-theme"' >> hugo.toml
```

Requires Hugo ≥ `0.164.0` (developed against ~0.166.x; `theme.toml` `min_version`). **Hugo Extended is not required**. See [Configuration](#configuration) for params.

## Versioning & updates

This theme follows a **rolling `main`** model for now (no release tags yet). Track `main` tip for the latest, or **pin a commit SHA** when you need a frozen tree.

### Submodule

```bash
git -C themes/hugo-antfustyle-theme fetch origin
git -C themes/hugo-antfustyle-theme checkout main
git -C themes/hugo-antfustyle-theme pull --ff-only origin main
# pin instead of tip:
# git -C themes/hugo-antfustyle-theme checkout <commit-sha>
git add themes/hugo-antfustyle-theme
git commit -m "chore: bump hugo-antfustyle-theme"
```

Note: `checkout main` alone may leave a stale local `main` unchanged; the `pull --ff-only` (or explicit `checkout <sha>`) is what advances the pin. Prefer that over `git submodule update --remote` unless you have configured the submodule to track `main`.

### Plain clone

```bash
git -C themes/hugo-antfustyle-theme pull --ff-only origin main
# or pin:
# git -C themes/hugo-antfustyle-theme fetch origin && git -C themes/hugo-antfustyle-theme checkout <commit-sha>
```

## Configuration

Configure via `[params]` in your site `hugo.toml`:

```toml
[params]
  description = "Site subtitle"
  homeIntro = "A short intro; **Markdown** is fine"
  homeAbout = "A longer about blurb"
  homeRecentCount = 8
  homeRecentTitle = "Recent posts"
  homeAllPostsLabel = "View all posts"

  [[params.homeGroups]]
    label = "Writing about"
    [[params.homeGroups.items]]
      name = "Web"
      url = "/tags/web/"
    [[params.homeGroups.items]]
      name = "Design"
```

Omit `homeGroups.items.url` to render plain text (no fake links). Use `footerNote` for optional footer text.

Optional icons (omit either to skip that `<link>`):

```toml
[params]
  favicon = "/favicon.ico"
  appleTouchIcon = "/apple-touch-icon.png"
```

### Social share image

Used for `og:image` / `twitter:image`, and fills `BlogPosting.image` in the
JSON-LD. Use a 1200×630 image:

```toml
[params]
  socialImage = "/social-image.png"
```

By default a page in `mainSections` **never** falls back to it — its share image
must be its own (`image` / `cover` / `featuredImage` front matter). Set
`socialImageFallback = true` to let those pages fall back to the site image too:

```toml
[params]
  socialImageFallback = true
```

### Theme credit (`themeCredit`)

The footer shows a muted **Powered by [Hugo Antfustyle Theme](https://github.com/youtzz/hugo-antfustyle-theme)** line by default (common practice; not antfu branding).

```toml
[params]
  # Omit or true → show credit (default)
  themeCredit = false   # hide the default credit line
```

To replace the whole footer (or credit copy), soft-override `layouts/partials/hugo-antfustyle-theme/footer.html` in your site. To append extras without removing the credit, use `footer-extend.html` (see Project-level hooks).

### Page decoration (`[params.art]`)

Built-in registry: `plum` → `js/plum.js`, `dots` → `js/dots.js`. The loader mounts **only** from the registry. It waits for `load` / `requestIdleCallback` (2s timeout) before mounting, so the decoration script does not contend with first paint.

**Plum only:**

```toml
[params.art]
  active = "plum"
  pool = ["plum", "dots"]
```

**Dots only:**

```toml
[params.art]
  active = "dots"
  pool = ["plum", "dots"]
```

**Random from pool (uniform each load):**

```toml
[params.art]
  active = "random"
  pool = ["plum", "dots"]
```

`active`: `off` | registered name | `random`. Unknown name / empty `pool` → fail soft to off. Unconfigured default: `active=plum`.

#### Custom art (`extra`)

```toml
[params.art]
  active = "random"
  pool = ["plum", "dots", "spark"]

[params.art.extra.spark]
  # Path relative to assets/; key is the name for pool / active
  script = "js/art-spark.js"
```

Mount contract: clear `.page-decoration` → create `canvas#{name}-canvas` → load that script only.

#### Per-page override & compatibility

Front matter overrides `active` only:

```yaml
---
title: Some post
art: dots
---
```

Legacy `params.art = "dots"` (string) is treated as `active`. Missing `pool` → all built-ins.

`prefers-reduced-motion: reduce` acts as `off` (no mount, no script download).

## Project-level hooks

Optional extension points (define in your site, not the theme):

- `layouts/partials/custom_head.html` — head extras
- `layouts/partials/custom_body.html` — bottom-of-page scripts
- `layouts/partials/brand-logo.html` — replace the built-in brand logo (explicit hook, checked with `templates.Exists`; the theme renders its own default when absent)
- `layouts/partials/hugo-antfustyle-theme/hero-extend.html` — home extras
- `layouts/partials/hugo-antfustyle-theme/post-body-extend.html` — inside `.post-body` after content (e.g. signature)
- `layouts/partials/hugo-antfustyle-theme/post-extend.html` — post extras below the body (e.g. comments)
- `layouts/partials/hugo-antfustyle-theme/footer-extend.html` — footer extras (appends after the default credit)
- `layouts/partials/hugo-antfustyle-theme/footer.html` — soft-override to replace the entire footer (incl. credit)
- `layouts/partials/reading-time.html` — override reading-time label (theme ships a default)
- `assets/custom.css` — project CSS; Hugo template expressions OK; fingerprinted & minified

## Local preview (this repo)

```bash
mkdir -p exampleSite/themes
ln -sfn "$(pwd)" exampleSite/themes/hugo-antfustyle-theme
hugo --source exampleSite --minify
# or: hugo server --source exampleSite
```

For local serving, override baseURL if needed:

```bash
hugo server --source exampleSite --baseURL http://localhost:1313/
```

## Credits

- **Visual language / ArtPlum / ArtDots inspiration**: [antfu.me](https://antfu.me/) by [Anthony Fu](https://github.com/antfu). This theme’s **default logo is an Awakestone-style「石」mark**, not antfu’s `af` path. antfu.me’s **brand marks, images, and page content** remain under Anthony’s own rights; do not treat them as free for commercial reuse just because its site code is MIT. Sites can swap the logo via the `layouts/partials/brand-logo.html` hook (see Project-level hooks).
- Related Astro inspiration (not a dependency): [lin-stephanie/astro-antfustyle-theme](https://github.com/lin-stephanie/astro-antfustyle-theme)
- Built for [Hugo](https://gohugo.io/) ≥ 0.164.0 (Extended optional)

## Contributing

Issues and small PRs welcome. Prefer project-level hooks and `[params.art.extra]` over growing the theme into a kitchen sink. Please keep the visual language restrained.

## License

[MIT](LICENSE) © keishi
反馈内容错误

看看同类模板

对比同技术栈与用途的模板,找到更适合的视觉与内容结构。