Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SHUIYIN — 博客站点

Hugo 静态站,自建极简主题(无外部主题依赖),GitHub Pages 部署。

一、本地跑起来

Hugo 是单个可执行文件,Windows 上不需要 Node、不需要 Ruby。

  1. https://github.com/gohugoio/hugo/releases 下载 hugo_extended_x.x.x_windows-amd64.zip
  2. 解压出 hugo.exe,放到任意目录,把该目录加进 PATH
  3. 在本仓库根目录执行:
hugo server -D

浏览器打开 http://localhost:1313 即可,改文件会自动刷新。

二、目录结构

hugo.toml                     站点配置(标题、评论、菜单都在这)
content/
  posts/                      笔记,一篇一个 .md
  plugins/                    插件说明,一个插件一个 .md
  sdk/                        SDK 速查
  about.md                    关于页
layouts/
  index.html                  首页:状态条 + 插件 BOM 表 + 笔记列表
  _default/baseof.html        页面骨架
  _default/list.html          列表页(插件区自动切成 BOM 表)
  _default/single.html        文章页 + 评论
  partials/head.html          <head>
  partials/header.html        顶栏
  partials/footer.html        页脚(CAD 图纸标题栏)
  partials/comments.html      评论区
static/css/main.css           全部样式,改配色改这一个文件
.github/workflows/deploy.yml  推送到 main 自动构建部署

三、写新文章

content/posts/ 新建 .md,front matter 用这个模板:

---
title: "标题"
date: 2026-08-01
summary: "一句话摘要,会出现在列表页"
tags: ["PS SDK", "坐标系"]
---

插件页在 content/plugins/,多两个字段:

---
title: "AutoPathPlanner"
date: 2026-07-18        # 这个日期就是 BOM 表里的「更新」列
version: "5.0"          # BOM 表里的「版本」列
summary: "焊接路径自动规划与干涉集管理"
repo: "https://github.com/ShuiYinMaster/TxTools"
---

四、评论区配置

hugo.toml 里的 commentSystem 控制用哪套,三选一:giscus / twikoo / none

方案 A:giscus(默认,零维护)

评论存在 GitHub Discussions 里,不需要服务器、不需要数据库。 代价是读者必须有 GitHub 账号才能留言。

  1. 直接用本站仓库即可,不用另开仓库
  2. 仓库 Settings → General → Features,勾选 Discussions
  3. 安装 giscus app:https://github.com/apps/giscus
  4. 打开 https://giscus.app,填入仓库名,页面下方会生成一段代码
  5. 把生成代码里的 data-repo-iddata-category-id 两个值, 填进 hugo.toml[params.giscus] 对应字段,repo 填成你的站点仓库名

主题已设为 preferred_color_scheme,会跟随读者系统的深浅色。

方案 B:twikoo(免登录)

读者填个昵称就能评论,更适合不一定有 GitHub 账号的国内工程师读者。 代价是要自己部署一个后端。

  1. https://twikoo.js.org/quick-start.html 部署到 Vercel(免费额度够用)
  2. 拿到部署地址,填进 hugo.toml[params.twikoo] envId
  3. commentSystem 改成 "twikoo"

两套都已经写好在 layouts/partials/comments.html 里,切换只改配置、不动代码。

五、部署

  1. 把整个目录推到 GitHub 仓库的 main 分支
  2. 仓库 Settings → Pages → Source 选 GitHub Actions
  3. 之后每次 push 到 main 会自动构建发布

hugo.toml 里的 baseURL 记得改成你实际的站点地址。

六、想改外观

配色、字体、间距全部集中在 static/css/main.css 顶部的 :root 里。 --ax-x / --ax-y / --ax-z 是页面上唯一的三处彩色(章节轴标记、链接下划线、引用块左边线), 其余全是灰阶,改这三个值就能整体换调性。深色模式在紧跟着的 @media (prefers-color-scheme: dark) 块里,成对改。

七、后续可以自动化的地方

插件矩阵那张 BOM 表现在是手写 markdown 维护的。 如果嫌每次发版还要回来改版本号,可以写个小脚本读 GitHub Releases API, 把结果生成到 data/plugins.json,模板改成从 .Site.Data.plugins 取数即可。

Releases

Packages

Contributors

Languages