Skip to content

Repository files navigation

InuDial.github.io

基于 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

首次发布

  1. 提交当前文件:

    git add .
    git commit -m "init: create blog"
  2. 登录 GitHub CLI 并创建公开仓库,暂不推送:

    gh auth login
    gh repo create InuDial/InuDial.github.io --public --source=. --remote=origin
  3. 将 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"

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages