Hexo

初始化项目

安装Hexo框架

安装Node.js

Node.js是JavaScript运行环境,支持JavaScript运行在服务端的开发平台

Node.js官网地址:https://nodejs.org/

202205201211462

202205201226136

查看node和npm版本

1
2
node -v
npm -v

202205201230549

安装淘宝镜像源的cnpm管理器

1
npm install -g cnpm --registry=http://registry.npm.taobao.org

202205201235464

使用cnpm安装hexo

1
cnpm install -g hexo-cli

202205201237355

202205202055699

新建本地博客服务

新建文件夹并进入该目录

202205202328578

初始化hexo

1
hexo init	

202205202357848

202205202357655

启动本地服务

1
hexo s

202205202359271

本地访问地址

1
http://localhost:4000/

202205210000921

创建新的文章

1
hexo n "My New Post"

202205210005873

清理并生成

1
2
hexo clean
hexo g

202205210008839

远端部署Github

创建一个新的仓库

1
YourGithubName.github.io

image-20220521013933355

在Blog目录下安装git部署插件

1
cnpm install --save hexo-deployer-git

image-20220521014255050

配置_config.yml

image-20220521014451812

image-20220521015324639

部署到Github远端

1
hexo d

image-20220521015431257

查看博客

1
https://YourGithubName.github.io/ 

image-20220521015704706

修改主题

选择主题-Butterfly

1
2
3
4
//官网
https://butterfly.js.org/
//Git仓库
https://github.com/jerryc127/hexo-theme-butterfly

主题下载

1
2
//克隆到themes目录下的butterfly文件夹
git clone https://github.com/jerryc127/hexo-theme-butterfly themes/butterfly

image-20220521023716102

修改配置_config.yml

image-20220521023849882

执行命令

1
npm install --save hexo-renderer-jade hexo-generator-feed hexo-generator-sitemap hexo-browsersync hexo-generator-archive

image-20220521024656434

清理缓存

1
hexo clean

生成静态文件

1
hexo g

运行本地服务

1
hexo s

部署远端

1
hexo d

image-20220521025504184