搭建hexo博客系统

hexo一个主流的博客框架。

安装 hexo.io

1
2
3
4
5
全局安装    npm install hexo-cli -g

查看hexo版本,确保安装成功 hexo -v

切换到博客空目录,执行命令初始化 hexo init

启动博客,默认在浏览器中运行localhost:4000访问

hexo基础命令

1
2
3
4
5
6
7
8
9
10
11
添加文件  hexo new 文件名称

启动博客系统 hexo s

清理文件 hexo clean

生成文件 hexo g

部署到github远端,将本地同步到远端 hexo d

git部署的插件安装 npm install --save hexo-deployer-git

添加主题 melody

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
npm install hexo-renderer-pug hexo-renderer-stylus

复制
./node_modules/hexo-theme-melody/_config.yml
到 _config.melody.yml (没有就新增该配置文件)

进行配置文件的修改 _config.yml
例:
theme: melody
type: 'git'
repo: https://github.com/xinker17/xinker17.github.io
brach: master

主题更新
npm update hexo-theme-melody

如果出现:因为在此系统上禁止运行脚本

我们通过管理员权限运行power shell(可通过win+x打开),然后输入命令

1
set-ExecutionPolicy RemoteSigned
Author: xinker
Link: http://example.com/2023/03/10/搭建hexo博客系统/
Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.