BOSh
文章227
标签320
分类74
315晚会 36氪 80后 ADB AI AI Agent AI 代理 AI 助手 AI 网关 AI 评测 AI助手 AI大模型 AI安全 AI应用 AI智能体 AI网关 API API 集成 Agent AionUi Android Automation C++ CLI CLI Proxy API CLIProxyAPI CRM Chrome 插件 Claude Opus 4.6 ConnectBot Debian DeepSeek DenchClaw DevOps Docker GEO GPL GPS GPU Gemini Gemini 3.1 Pro GitHub Gmail Gog Google AI Pro Google API Google Gemini HKUDS Hermes Hermes Agent Hexo Hugo IPV6 Jetpack Compose Kimi-K2.5 Kotlin LINUX LaTeX Linux Markdow Markdown MemU Bot MiniMax NAT64 NIX NODE NVIDIA Build NanoClaw Netcatty Newsletter Open WebUI OpenAI OpenAI 兼容接口 OpenCLI OpenClaw PDF 编译 PicoClaw Prismer QClaw QQ机器人 RAG Reddit Rust SFTP SSH Skills Subagent SuperCall Telegram Bot WebSSH Windows WorkBuddy X X热榜 YouTube ZeroClaw arXiv arch c++ git hugo iMessage n8n nanobot node js ntfs pacman podman zz.ac 东海 两性关系 个人助理 中东 中东冲突 中东局势 中关村论坛 中南大学 中国 中美 习惯养成 云同步 亚洲 代理 以色列 任务管理 伊朗 伊朗危机 伊朗战争 伦理 体育 保护主义 信息流 信息管理 停火 健康管理 光通信 免费试用 共和党 养老金 内容工厂 内容生产 内容筛选 军事冲突 军事动态 军民融合 农村 分享 创业 办公自动化 加密 加密货币 加沙 北斗 医学生 半导体 华为 博客 博客助手 博客部署成功 卫星 原生 JS 反重力 台海局势 台湾 命令 喷嚏网 国产 国产化 国产替代 国际 国际关系 国际局势 国际新闻 图卦 图说 地缘政治 基础设施 多代理 多模态AI 大学分析 大模型 孙少平 学习 安全 实时监控 家庭助理 家庭服务器 家装设计 工作总结 工作效率 工作流编排 工具链 平凡的世界 平台责任 开发 开发实录 开源 开源项目 张雪峰 微信 心理健康 情感 战争 投资工具 指标看板 提示词工程 播客 收件箱清理 效率 效率工具 教程 教育制度 数据分析 数据投毒 文献管理 新能源汽车 新闻汇总 日历聚合 时事 时事总结 显卡 晨报 智能体 智能体生态 朝鲜 架构 架构实践 核协议 核武器 桌面Cowork 模型接入 每日图说 比亚迪 油价 活动运营 浏览器自动化 消息通道 消费者权益 渔船 游戏开发 湘雅医院 热点新闻 版本更新 特朗普 生态系统 生活 生活自动化 生物识别 用例 甲骨文云 电池技术 症状追踪 皮皮虾 监管 目标管理 知识库 社交媒体 社会保障 社会百态 社会观察 科技 科研助手 笔记 第一财经 算法推荐 纽森 经济 经济观察 经验分享 编程 网关 网络 网络安全 美伊关系 美伊冲突 美国 美国大选 美国政治 能源安全 能源市场 腾讯 腾讯,龙虾,OpenClaw 腾讯云 自动化 自动化创作 自动化协作 自动化提醒 自动化流水线 自动化运维 自律教练 自由软件 行为改变 视频摘要 记录 许可证 论文写作 论文阅读 语义搜索 语音代理 读书 读书笔记 读后感 财报季 路遥 迁移 运维 远程运维 邀请确认 部署指南 量子计算 销售自动化 阅读感悟 随笔 霍尔木兹海峡 项目管理 飞书 高中生活 高考志愿 黎巴嫩 龙虾

一言

文章归档

博客主题由极简的 M10c 迁移到结构复杂的 Stack

博客主题由极简的 M10c 迁移到结构复杂的 Stack

博客主题由极简的 M10c 迁移到结构复杂的 Stack

第一步 备份

  1. 最稳妥的备份方案:Git 分支法

既然你已经用了 Git,不需要手动复制文件夹。利用 Git 的分支功能是专业且最高效的备份方式。

1
2
3
4
5
6
7
8
9
10
11
12
# 1. 确保当前代码已全部提交
git add .
git commit -m "Backup before switching to Stack"

# 2. 创建一个名为 'm10c-version' 的备份分支
git branch m10c-version
git push origin m10c-version

# 3. 此时你可以放心在 main 分支折腾。
# 如果折腾坏了,随时可以用下面这行命令秒回原始状态:
# git reset --hard m10c-version

第二步 切换到主分支准备“动刀”

确保你现在处于 main 分支上(备份分支留在原地不动,作为“救命稻草”):

1
git checkout main

第三步:清理旧主题并添加新主题

在 Windows 上正确移除旧主题请在项目根目录按顺序执行以下命令:

  1. 从 Git 中移除子模块记录
1
2
git rm -r themes/hugo-theme-m10c

  1. 手动删除残留文件夹(如果报错说目录不存在可以忽略)
1
rd /s /q themes\hugo-theme-m10c
  1. 在添加新主题之前,建议先提交一次,保持 Git 记录清晰:
1
2
git add .
git commit -m "Remove old m10c theme"
  1. 重新添加 Stack 主题 现在可以干净地添加新主题了:
1
git submodule add https://github.com/CaiJimmy/hugo-theme-stack themes/hugo-theme-stack

第四步:复制示例配置文件

Stack 主题的功能非常多,手动写 hugo.toml 很容易出错。建议直接从主题目录拷贝官方提供的示例配置:

1. 在你的项目根目录找到 themes/hugo-theme-stack/exampleSite

2. 将其中的 hugo.yaml (或 config.yaml) 拷贝到你的根目录,并替换掉你原本的 hugo.toml

  • 注意:Stack 默认使用 YAML 格式配置。如果你习惯 TOML,需要手动转换,但我建议直接跟从作者使用 hugo.yaml

3. 调整文件夹结构

Stack 主题需要一些特殊的页面来支撑它的功能(如搜索、归档、关于):

  1. 复制资源文件:将 themes/hugo-theme-stack/exampleSite/content 下的 page 文件夹拷贝到你自己的 content/ 目录下。
    • 这个 page 文件夹里通常包含 archives.md (归档) 和 search.md (搜索)。
  2. 文章目录:确保你的文章都在 content/post/ 目录下(Stack 默认识别 post 而不是 posts,你可以在配置文件中修改)。
  3. m10c 比较简单,但 Stack 增加了一些视觉元素。建议在你的旧文章头部(Front Matter)添加以下字段:
1
image= "https://bed.886423.xyz/file/1766555872266_11.jpg"
  1. 针对你之前的 GitHub Actions 部署优化
    因为 Stack 依赖 Hugo 的一些高级功能,请确保你的 .github/workflows/deploy.yml 中的 Hugo 设置如下:
1
2
Extended 版本:Stack 使用了 SCSS,必须开启 extended: true。
Hugo 版本:建议指定一个较新版本(如 0.120.0 以上)。
1
2
3
4
5
6
- name: Setup Hugo
uses: peaceiris/actions-hugo@v3
with:
hugo-version: '0.125.0' # 建议明确版本
extended: true # 必须为 true

😄

4. 美好和定制

修改配置文件hugo.yaml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
baseurl: https://example.com/
languageCode: zh-cn
theme: hugo-theme-stack
title: 博士日常
copyright: BoSh

# Theme i18n support
# Available values: ar, bn, ca, de, el, en, es, fr, hu, id, it, ja, ko, nl, pt-br, th, uk, zh-cn, zh-hk, zh-tw
DefaultContentLanguage: zh-cn
# 禁用多语言功能,防止生成 /zh-cn/ 这样的子目录
disableLanguages: ["en", "es"]

# Set hasCJKLanguage to true if DefaultContentLanguage is in [zh-cn ja ko]
# This will make .Summary and .WordCount behave correctly for CJK languages.
hasCJKLanguage: false

languages:

zh-cn:
languageName: 简体中文
title: 博士日常
weight: 1
params:
sidebar:
subtitle: 记录生活 分享知识



services:
# Change it to your Disqus shortname before using
disqus:
shortname: "hugo-theme-stack"
# GA Tracking ID
googleAnalytics:
id:

pagination:
pagerSize: 3

permalinks:
post: /p/:slug/
page: /:slug/

params:
mainSections:
- post
featuredImageField: image
rssFullContent: true
favicon: # e.g.: favicon placed in `static/favicon.ico` of your site folder, then set this field to `/favicon.ico` (`/` is necessary)

footer:
since: 2025
customText: 热爱生活 学无止境

dateFormat:
published: Jan 02, 2006
lastUpdated: Jan 02, 2006 15:04 MST

sidebar:
emoji: 😍
subtitle: 终身学习者 / 开发者
avatar:
enabled: true
local: false
src: img/avatar.png

article:
math: false
toc: true
readingTime: true
license:
enabled: true
default: Licensed under CC BY-NC-SA 4.0


widgets:
homepage:
- type: search
- type: archives
params:
limit: 5
- type: categories
params:
limit: 10
- type: tag-cloud
params:
limit: 10
page:
- type: toc

opengraph:
twitter:
# Your Twitter username
site:

# Available values: summary, summary_large_image
card: summary_large_image

defaultImage:
opengraph:
enabled: false
local: false
src:

colorScheme:
# Display toggle
toggle: true

# Available values: auto, light, dark
default: auto

imageProcessing:
cover:
enabled: true
content:
enabled: true

### Custom menu
### See https://stack.jimmycai.com/config/menu
### To remove about, archive and search page menu item, remove `menu` field from their FrontMatter
# 找到原来的 menu 部分并替换成这样:
menu:
main:
- identifier: home
name: 首页
url: /
weight: -100
params:
icon: home


social:


- identifier: vercel-blog
name: BLOG ON Vercel
url: https://886423.xyz
params:
icon: link # 改为 link

- identifier: github
name: GitHub
url: https://github.com/zhisibi
params:
icon: brand-github

- identifier: vps-blog
name: BLOG ON VPS
url: https://bosh.zz.ac
params:
icon: link #



related:
includeNewer: true
threshold: 60
toLower: false
indices:
- name: tags
weight: 100

- name: categories
weight: 200

markup:
goldmark:
extensions:
passthrough:
enable: true
delimiters:
block:
- - \[
- \]
- - $$
- $$
inline:
- - \(
- \)
renderer:
## Set to true if you have HTML content inside Markdown
unsafe: true
tableOfContents:
endLevel: 4
ordered: true
startLevel: 2
highlight:
noClasses: false
codeFences: true
guessSyntax: true
lineNoStart: 1
lineNos: true
lineNumbersInTable: true
tabWidth: 4

本文作者:BOSh
本文链接:http://bosh.zz.ac/posts/2347456530.html
版权声明:本文由BoSh发布,部分内容来源于网络。