惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

G
Google Developers Blog
人人都是产品经理
人人都是产品经理
腾讯CDC
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
WordPress大学
WordPress大学
S
SegmentFault 最新的问题
小众软件
小众软件
B
Blog
博客园 - 叶小钗
Microsoft Azure Blog
Microsoft Azure Blog
Apple Machine Learning Research
Apple Machine Learning Research
A
About on SuperTechFans
J
Java Code Geeks
Blog — PlanetScale
Blog — PlanetScale
博客园 - 司徒正美
博客园 - 【当耐特】
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Recent Announcements
Recent Announcements
宝玉的分享
宝玉的分享
Martin Fowler
Martin Fowler
Hugging Face - Blog
Hugging Face - Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Last Week in AI
Last Week in AI
V
V2EX

ncc的个人网站

MCSManager 数据备份与迁移实践 Goland Update Delve frp反向代理群晖WebDAV服务器 1panel安装的Mysql版本从5.7升级到8.4.5 备份mc服务器脚本 威联通使用screen报错 Cannot find terminfo entry for 'screen.linux' Brew No Available Formula Gitea迁移和SSH容器直通 QQ邮箱文件夹重新开启通知 Act_runner 使用 supervisor 启动无法正常识别到 asdf 设置的环境问题(二)
将博客从Typecho迁移到Hugo
FGHWETT · 2024-11-10 · via ncc的个人网站

警告

本文最后更新于 2025-01-22,文中内容可能已过时。

上半年的时候,蓝易云搞了个CDN,送我我一年的体验时间,于是我就想着将博客框架换成hugo,顺便体验一下artalk。

当时其实已经搞了一半,但是后来一只没时间进行细化(主题和artalk涉及的自定义项目太多了),也就搁置到了现在。

大致流程

  1. 创建对应的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
  1. 导出博客内容为对应的格式

    这里我是直接连接到数据库,并且编写相应的代码,将文章和分类导出来了。目前代码不完善且不能适配所有情况,所以就不放了,有需求的可以直接在github搜索相关关键词,使用其他人的。

  2. 搭建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本身的设置,主题还有大量设置,目前我只是大概过了一遍。