注:以下默认使用Butterfly主题

常用命令

命令均需在博客根目录下执行

本地预览

1
hexo clean&&hexo g&&hexo s

部署发布

1
hexo clean&&hexo g&&hexo d

新建文章

1
hexo new “标题”

更新主题

在主题相应目录下执行

1
git pull

查看已安装的Hexo插件

1
npm ls --depth=0

易错点

图片存放

博客部署时图片应该存放至
/Blog/themes/butterfly/source/img/
才能正常应用新图片

主题配置

Hexo 会自动合并主题中的 _config.yml 和 _config.butterfly.yml 里的配置,如果存在同名配置,会使用 _config.butterfly.yml 的配置,其优先度较高。升级完成后,到 Github 的 Releases 界面查看新版的更新内容。
里面有标注 _config 文件的变更内容(如有),需根据实际情况更新配置内容。

_config.yml

GitHub推送

需在_config.yml结尾填写以下内容,注意缩进
使用SSH,需要本地有SSH私钥

1
2
3
4
deploy:
type: git
repository: git@github.com:Github用户名/GitHub用户名.github.io.git
branch: main

部分配置

网站时区(timezone)、语言(language)、简介(description)、标题(title)、所有者(author)及指定主题(theme)需在此配置文件设定

备忘

安装的插件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
hexo-site@0.0.0 /home/用户名/Blog
├── hexo-deployer-git
├── hexo-generator-archive
├── hexo-generator-category
├── hexo-generator-index
├── hexo-generator-searchdb
├── hexo-generator-tag
├── hexo-renderer-ejs
├── hexo-renderer-marked
├── hexo-renderer-pug
├── hexo-renderer-stylus
├── hexo-server
├── hexo-theme-landscape
├── hexo-wordcount
└── hexo