基于 Hugo、PaperMod 和 KaTeX 的静态博客。文章、标签与草稿均由仓库中的 Markdown 文件管理,推送到 main 后由 GitHub Actions 自动发布到 GitHub Pages。
本地需要 Git 和 Hugo Extended 0.146.0 或更高版本。本仓库固定使用 Hugo 0.164.0 进行线上构建。
克隆仓库时同时拉取主题:
git clone --recurse-submodules git@github.com:InuDial/InuDial.github.io.git
cd InuDial.github.io如果已经完成普通克隆,补拉 submodule:
git submodule update --init --recursive创建草稿:
hugo new content posts/my-post.md文章头部使用 YAML front matter:
---
title: "文章标题"
date: 2026-07-20T12:00:00+08:00
draft: true
tags:
- Rust
- Architecture
math: false
---draft: true的文章不会进入生产站点;发布时改为false。tags可以填写多个标签,Hugo 会自动维护/tags/下的索引页。- 文章包含
$...$或$$...$$公式时,将math改为true。 - 文章 URL 由 Markdown 文件名决定;发布后不要随意重命名文件,以免旧链接失效。
- 图片放入
static/images/,在文章中使用/images/example.png引用。
本地预览草稿:
hugo server -D生产构建:
hugo --gc --minify-
提交当前文件:
git add . git commit -m "init: create blog"
-
登录 GitHub CLI 并创建公开仓库,暂不推送:
gh auth login gh repo create InuDial/InuDial.github.io --public --source=. --remote=origin
-
将 Pages 配置为 GitHub Actions 模式,然后首次推送:
gh api --method POST repos/InuDial/InuDial.github.io/pages -f build_type=workflow git push -u origin main
也可以在仓库的
Settings -> Pages中将Source设为GitHub Actions,再执行git push -u origin main。
首次工作流完成后,站点位于 https://inudial.github.io/。
主题被固定为 Git submodule。需要升级时显式更新并检查站点,再提交新的主题 commit:
git -C themes/PaperMod pull --ff-only
git add themes/PaperMod
git commit -m "chore: update PaperMod"