警告
本文最后更新于 2025-01-22,文中内容可能已过时。
上半年的时候,蓝易云搞了个CDN,送我我一年的体验时间,于是我就想着将博客框架换成hugo,顺便体验一下artalk。
当时其实已经搞了一半,但是后来一只没时间进行细化(主题和artalk涉及的自定义项目太多了),也就搁置到了现在。
大致流程
- 创建对应的Hugo项目,并选择喜欢的主题。
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
| # 新建站点
hugo new site blog_name
# 添加主题
git init .
git submodule add https://github.com/hugo-fixit/FixIt.git themes/FixIt
echo "theme = 'FixIt'" >> hugo.toml
echo "defaultContentLanguage = 'zh-cn'" >> hugo.toml
# 切换主题分支
git submodule add -b dev https://github.com/hugo-fixit/FixIt.git themes/FixIt
# 升级主题
git submodule update --remote --merge themes/FixIt
# 添加内容
hugo new content posts/my-first-post.md
# 本地启动 -D 查看草稿
hugo server -D
# 修改主题配置文件
mv hugo.toml hugo.old.toml
cp themes/FixIt/hugo.toml hugo.toml
echo "theme = 'FixIt'" >> hugo.toml
|
导出博客内容为对应的格式
这里我是直接连接到数据库,并且编写相应的代码,将文章和分类导出来了。目前代码不完善且不能适配所有情况,所以就不放了,有需求的可以直接在github搜索相关关键词,使用其他人的。
搭建artalk服务,并迁移typecho的评论
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
| services:
artalk:
container_name: artalk
image: artalk/artalk-go:2.9.1
restart: unless-stopped
ports:
- 30100:23366
volumes:
- ./data:/data
environment:
- TZ=Asia/Shanghai
- ATK_LOCALE=zh-CN
networks:
- 1panel-network
networks:
1panel-network:
external: true
|
其实流程并不是很复杂,主要还是配置项目太多,hugo本身的设置,主题还有大量设置,目前我只是大概过了一遍。