Hugo作品集博客

hugo-xpage — Hugo 作品集模板

作者 Jensen-JZ

hugo-xpage 是一个采用黑、白、电光黄配色的 Hugo 主题,面向个人主页与技术博客,支持英/简中/繁中三语内容块与按需加载的 KaTeX、Mermaid、Prism。

看看你的网站会是什么样

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

1 个预览视图
作者提供的预览
作者提供的预览首屏预览

来自项目 README 的原始预览。

目前有 1 张原始预览,可打开完整图片查看设计细节。

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

采集于 2026-10-02查看来源

值得关注的模板亮点

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

01

黑白电光黄配色与方角设计约定,自定义十字准星光标

02

通过 lang-block 容器在客户端切换英/简中/繁中三语内容

03

5 个图片与图表 shortcode:image-size、image-grid、image-carousel、live-photo、mermaid

04

Prism、KaTeX、Mermaid 按需加载,无对应内容的页面不引入这些脚本

05

图片点击灯箱、Live Photo 悬停播放、主题切换、搜索弹窗与返回顶部

06

输出 Open Graph、Twitter Card、canonical、sitemap、RSS 与 robots.txt

模板详细介绍

hugo-xpage 是一个 Hugo 主题,用于搭建个人站点与技术博客。视觉上采用黑、白、电光黄三色,强调方角设计:除导航胶囊外不使用 border-radius,使用自定义十字准星光标,图片点击可打开灯箱,Live Photo 悬停播放并带 LIVE 标记。

多语言方面,主题通过 `<div class="lang-block">` 容器在客户端切换英文、简体中文和繁体中文内容,正文需按语言分别包裹,默认语言块标记 data-active="true"。首页为单页长布局,包含 hero、about、what-do、journey、projects、writing、photography、contact 等区块,由 exampleSite/data 下的 8 个 TOML 文件驱动;文章列表与详情页共用同一套 i18n 机制。

内容能力上提供 5 个 shortcode:image-size、image-grid、image-carousel、live-photo、mermaid。Prism 语法高亮、KaTeX 数学公式、Mermaid 图表均按需加载,页面不含数学、图表或代码时不引入对应脚本。SEO 方面输出 Open Graph、Twitter Card、canonical、sitemap、RSS 与 robots.txt,并提供 1200×630 的 OG 卡片。

使用限制:文章 frontmatter 约定较严格,listing 与 i18n 依赖这些字段;行内数学需用双反斜杠转义 `\\(...\\)`,否则 Goldmark 会吞掉括号;Mermaid 与多语言块、Prism 的 language-X 类名匹配都有已知冲突,主题已做处理,但修改相关逻辑时需注意。Prism、KaTeX、Mermaid 从 jsdelivr 按需加载,无打包器、无需 npm install。

Hugo作品集博客

适合你的项目吗?

适用场景

  • 搭建带多语言内容的个人主页或作品集
  • 撰写含代码高亮、数学公式与 Mermaid 图表的技术博客
  • 展示摄影作品,使用图片网格、轮播与 Live Photo 悬停播放
  • 需要中英或简繁双语切换的站点

适合人群

  • 使用 Hugo 构建静态站点的个人开发者或写作者
  • 需要英文、简体中文、繁体中文三语内容切换的站点
  • 希望以图片和图表为主要表达方式的作品集或摄影页面
  • 偏好方角、高对比度编辑风视觉的站点

上手与定制指南

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

  1. 1

    将主题克隆到站点 themes/ 目录,并在 hugo.toml 中设置 theme = "hugo-xpage"

  2. 2

    从 exampleSite/hugo.toml 复制 [params] 块到自己的配置,并替换作者、域名、OG 图片等占位值

  3. 3

    首页各区块由 exampleSite/data 下 8 个 TOML 文件驱动,需按自身内容编辑

  4. 4

    界面文案集中在 data/i18n.toml,按 [en]/[zh]/[tw] 分节替换

  5. 5

    文章正文需用三个 lang-block 容器分别包裹各语言内容,并遵循示例文章的 frontmatter 字段约定

查看仓库使用说明

授权与来源资料

使用条件与限制

免费使用 · 保留许可声明

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

使用时需要遵守

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

额外费用与待核对事项

  • Prism、KaTeX、Mermaid 均从 jsdelivr CDN 按需加载,站点运行时依赖外部 CDN 服务;离线或无法访问 jsdelivr 时这些高亮、公式与图表功能不可用。
  • 字体来自 Google Fonts 与系统字体栈,属于外部第三方资源,使用前需自行确认其许可与可用性。
  • 示例文章文案为占位内容,可自由删除;示例站点中的 OG 卡片等演示素材需替换为自己的内容。
  • 演示图片、字体、图标及其他第三方素材需按各自许可核对,不能仅凭代码的 MIT 许可判断。
  • 域名、托管、数据库、支付或 AI 等外部服务可能另外收费。
查看原文依据

Permission is hereby granted, free of charge

许可证原文

All three are loaded from jsdelivr. No bundler. No npm install.

README 原文

Inter / Newsreader / JetBrains Mono — typefaces (Google Fonts + system stack)

README 原文

The example post copy is placeholder text and free to delete.

README 原文
https://github.com/Jensen-JZ/hugo-xpage/blob/main/LICENSEhttps://github.com/Jensen-JZ/hugo-xpage/blob/main/README.md

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

项目核对记录与介绍依据

模板资料

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

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

这个项目需要核对什么

记录的仓库更新时间
2026-05-07
截图检查日期
2026-10-02

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

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

查看具体选型方法 →

介绍的制作与核对状态

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

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

查看当时使用的来源资料

SHA-256: 6bf63b550f128be6124fbd031e92c4783b56fb660d68ccf7cb3e35674e6dcdc8

2026-10-02T14:14:40.260Z

来源文件 / 仓库
# hugo-xpage

A black, white, and electric-yellow Hugo theme for personal sites and technical blogs.
Multilingual (en / 简体中文 / 繁體中文) lang-blocks switched client-side. Five image
shortcodes plus on-demand KaTeX, Mermaid, and Prism syntax highlighting that load only
when a page actually uses them. Square-design contract — no rounded chrome buttons,
custom crosshair cursor, click-to-lightbox on every image, Live Photo with hover-play.

![hugo-xpage homepage screenshot](images/screenshot.png)

> Live demo: [peritrix.com](https://peritrix.com).

---

## Demo

```bash
git clone https://github.com/Jensen-JZ/hugo-xpage.git
cd hugo-xpage/exampleSite
hugo server -D --bind 127.0.0.1 --port 1313 --disableFastRender
# → http://localhost:1313/
```

The exampleSite ships two posts:
- `hello-world.md` — minimal multilingual post template
- `feature-showcase.md` — exercises every block (Markdown, Prism, KaTeX, Mermaid, all 5 shortcodes)

---

## Install in your own site

The theme works the standard Hugo way: clone into `themes/` and reference it in your config.

```bash
# from the root of your Hugo site
mkdir -p themes
git submodule add https://github.com/Jensen-JZ/hugo-xpage.git themes/hugo-xpage
```

Then in your `hugo.toml`:

```toml
theme = "hugo-xpage"
```

That's it. Copy the contents of `exampleSite/data/`, `exampleSite/content/`, and the `[params]` block from `exampleSite/hugo.toml` into your own site as a starting point.

---

## What you get

| Feature | Status |
|---|---|
| Multilingual posts via `<div class="lang-block">` (en / zh / tw) | ✓ |
| Single-page portfolio layout (hero · about · what-do · journey · projects · writing · photography · contact) | ✓ |
| Long-form blog with multilingual lang-blocks | ✓ |
| Full SEO surface — OG, Twitter Card, canonical, sitemap, RSS, robots.txt | ✓ |
| Open Graph card (1200×630) | ✓ |
| 5 shortcodes — `image-size`, `image-grid`, `image-carousel`, `live-photo`, `mermaid` | ✓ |
| On-demand Prism.js syntax highlighting (only loads if the page has fenced code) | ✓ |
| On-demand KaTeX (only if `$$ … $$` or `\\(…\\)` exists on the page) | ✓ |
| On-demand Mermaid v10 (only if `<pre class="mermaid">` exists) | ✓ |
| Click-to-lightbox on every image | ✓ |
| Live Photo hover-to-play with LIVE badge | ✓ |
| Custom crosshair cursor + theme switcher + search modal + back-to-top | ✓ |
| Square-design contract — no `border-radius` outside chrome nav pills | ✓ |
| 404 page (branded) | ✓ |

A blank-content page with no math, no diagrams, no code stays at zero JS dependencies.

---

## Project layout

```
hugo-xpage/
├── archetypes/              # default.md
├── assets/                  # bundled JS/CSS (theme assets)
├── i18n/                    # Hugo i18n hook (real i18n lives in exampleSite/data/i18n.toml)
├── layouts/
│   ├── _default/
│   │   ├── single.html      # post template
│   │   └── list.html        # listing template
│   ├── index.html           # homepage (long single-page)
│   ├── 404.html
│   ├── partials/
│   │   ├── chrome/          # nav · rail · lightbox · search · seo · ...
│   │   ├── sections/        # homepage sections (hero/about/whatdo/...)
│   │   ├── post-styles/     # _article.css · _shortcodes.css (inlined)
│   │   └── post-scripts/    # _base.js · _shortcodes.js · _codeblock.js · _mermaid.js
│   └── shortcodes/
│       ├── image-size.html
│       ├── image-grid.html
│       ├── image-carousel.html
│       ├── live-photo.html
│       └── mermaid.html
├── static/
│   ├── assets/site-header.css   # 20 KB — single CSS source-of-truth
│   ├── assets/live/             # 6 demo Live Photo .mov + .jpg pairs
│   └── favicon.ico
├── theme.toml
├── LICENSE
└── exampleSite/
    ├── hugo.toml            # placeholder values — copy [params] into your own
    ├── content/posts/
    │   ├── hello-world.md
    │   └── feature-showcase.md
    ├── data/                # 8 toml files driving the homepage sections
    │   ├── about.toml
    │   ├── identity.toml
    │   ├── whatdo.toml
    │   ├── journey.toml
    │   ├── projects.toml
    │   ├── photography.toml
    │   ├── social.toml
    │   └── i18n.toml        # all UI strings in 3 languages
    └── static/assets/
        └── og-card.png      # demo OG card — replace with your own
```

---

## Authoring posts

The frontmatter convention is rigid because the listing/i18n machinery depends on it.
Use `exampleSite/content/posts/hello-world.md` as the canonical template.

```yaml
---
title: "Post Title"
slug: post-slug
date: '2026-01-01T00:00:00+00:00'
weight: 1
postId: post-slug
i18nKey: post.slug.title
categoryI18n: cat.notes      # cat.research / cat.tech / cat.travel / cat.lifestyle / cat.notes
dateDisplay: 2026·01·01
bylineDate: 2026 · 01 · 01
kickers:                     # eyebrow text per language
  en: NOTES · 2026
  zh: 笔记 · 2026
  tw: 筆記 · 2026
readTimes:
  en: 1 min read
  zh: 阅读约 1 分钟
  tw: 閱讀約 1 分鐘
heroCaption: F · 001 · KEY
titles:                      # per-language H1
  en: "..."
  zh: "..."
  tw: "..."
decks:                       # SEO description + listing deck
  en: "..."
  zh: "..."
  tw: "..."
prev: { href: /posts/X.html, title: "← Previous title" }
next: { href: /posts/Y.html, title: "Next title →" }
lastmod: '2026-01-01T00:00:00+00:00'
---
```

The body must be wrapped in three `<div class="lang-block" data-lang="en|zh|tw">`
containers, with `data-active="true"` on the default. The runtime in
`partials/post-scripts/_base.html` toggles visibility on language switch.

### Shortcodes

| Block               | Syntax                                                                                              |
|---------------------|------------------------------------------------------------------------------------------------------|
| Single image        | `{{</* image-size src="…" alt="…" caption="…" center="true" */>}}`                                    |
| Image grid          | `{{</* image-grid columns="2" gap="1rem" images="src1\|\|cap1, src2\|\|cap2" */>}}`                    |
| Image carousel      | `{{</* image-carousel width="90%" center="true" autoplay="false" caption="…" images="s1, s2, s3" */>}}` |
| Live Photo          | `{{</* live-photo src="img.png" video="vid.mov" width="60%" caption="…" center="true" */>}}`           |
| Mermaid diagram     | `{{</* mermaid caption="…" */>}}` … `{{</* /mermaid */>}}`                                            |
| Math (inline)       | `\\(\\nabla_\\theta \\mathcal{L}\\)`                                                                  |
| Math (display)      | `$$ … $$`                                                                                            |
| Code with highlight | Standard fenced ` ``` `lang `… ` ``` `                                                                |

### Drafts

Add `draft: true` to the frontmatter. Local preview with `hugo server -D`. Production build (`hugo --gc --minify`) skips drafts automatically.

---

## Configuration

Copy the `[params]` block from `exampleSite/hugo.toml` into your own site's `hugo.toml`:

```toml
[params]
  author          = 'Your Full Name'
  authorFamiliar  = 'You'
  handle          = '@yourhandle'
  email           = '[email protected]'
  domain          = 'example.com'
  homepageURL     = 'https://example.com'
  description     = 'A short description for SEO and social cards.'
  ogImage         = 'https://example.com/assets/og-card.png'
  twitterHandle   = '@yourhandle'
  # … plus hero / chrome / copy fields — see exampleSite/hugo.toml for the full set
```

All UI strings live in `data/i18n.toml` (one section per language). Replace the
copy in each `[en]` / `[zh]` / `[tw]` block to translate the entire site.

The 8 `data/*.toml` files drive the homepage sections — about rows, identity
fields, what-I-do columns, journey timeline, projects, photography frames,
contact links. Edit them to match your own content.

---

## Design contracts (gotchas worth knowing)

The theme has a few opinionated behaviors that are easy to break if you don't
know they exist:

- **`<mark>` padding is 0.** The yellow swipe must hug the glyph; any padding obscures the previous character.
- **No `cursor: pointer`.** Custom crosshair for chrome, `cursor: zoom-in` for images, native pointer only inside the lightbox.
- **No `border-radius: 999px`** outside chrome nav pills. All buttons are square.
- **CJK-safe heading anchors.** The slugifier in `_base.html` keeps non-ASCII characters and dedupes IDs.
- **Goldmark eats `\(`.** When writing inline math, escape with double backslash `\\(...\\)`. Single `\(...\)` would render as literal `(...)`.
- **Mermaid + multi-language collision.** Three identical diagrams in three `lang-block` clones cause v10 to fail on duplicate node IDs. The loader renders only the active `lang-block` and re-renders on language switch — this is already handled.
- **Prism `language-X` regex collision.** The autoloader's class regex matches both `language-X` and `lang-X`, so `<div class="lang-block">` would trigger a 404 for a phantom `prism-block.min.js`. Suppressed by `Prism.manual = true` and explicit `Prism.highlightElement` calls — already handled.

---

## External CDN dependencies (loaded on demand)

The theme is HTML-first. JavaScript only loads when the page actually needs it:

- `[email protected]` — `prism-core` + autoloader + `prism-tomorrow.css`
- `[email protected]` — `katex.min.js` + `auto-render.min.js` + `katex.min.css`
- `[email protected]` — `mermaid.esm.min.mjs`

All three are loaded from jsdelivr. No bundler. No npm install.

---

## Deployment

The exampleSite produces a 5–6 MB `public/` of plain static files. Deploy anywhere:

```bash
hugo --gc --minify
# rsync, Cloudflare Pages, Vercel, GitHub Pages, Netlify — pick any
rsync -avz public/ user@host:/var/www/site/
```

---

## License & credits

MIT — see [LICENSE](LICENSE).

Runtime libraries (loaded from jsdelivr):

- [Hugo](https://gohugo.io) (BSD-3) — static site generator
- [Prism.js](https://prismjs.com) (MIT) — syntax highlighting
- [KaTeX](https://katex.org) (MIT) — math typesetting
- [Mermaid](https://mermaid.js.org) (MIT) — diagrams
- Inter / Newsreader / JetBrains Mono — typefaces (Google Fonts + system stack)

The theme code is © 2026 Jensen-JZ. Demo Live Photo clips bundled with the
theme are CC0 / generated. The example post copy is placeholder text and free
to delete.

If you build something with this, I'd love to see it — file an issue or PR
to add it to a "made with hugo-xpage" list.
反馈内容错误

看看同类模板

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