引言 {#引言}
迁移并不是无痛的,有些不兼容的地方,主要是下面几点。
title {#title}
需要在title上一行加一行---
date {#date}
需要是2023-09-01T01:00:00+08:00这样的格式
tags和categories {#tags和categories}
与hexo不同, hugo使用的是类似于数组的形式的, 例如本篇的tags就是["hexo", "hugo"], 而在hexo中则是
Hexo中配置
|---------------|-----------------------------|
| 1 2 3 | tags: - hexo - hugo |
Hugo中配置
|-----------|--------------------------------|
| 1 | tags: ["hexo", "hugo"] |
需要注意的是, 如果使用tags和categories, 需要在根配置文件里添加下列配置
|---------------|-----------------------------------------------------------|
| 1 2 3 | [taxonomies] tag = "tags" category = "categories" |
URL {#URL}
因为使用hexo已经收入了一些文章, 为了保持原url, 我的原hexo的配置是 /:year/:month/:day/:title/, 需要配置一项
Hexo中配置
|-----------|------------------------------------|
| 1 | /:year/:month/:day/:title/ |
Hugo中配置
|-------------|-------------------------------------------------------------|
| 1 2 | [permalinks] post = "/:year/:month/:day/:filename/" |
另外, 视情况可能还需要开启区分大小写的开关
|-----------|-----------------------------------|
| 1 | DisablePathToLower = true |
参考链接:https://cloud.tencent.com/developer/article/1561288
51工具盒子