node

安装 node、git、Vscode 软件,我前面 node 没有配置好,补充下面的配置

搜索里面查 cmd,右键命令指示符以管理员身份运行下面 下面都是管理员的 cmd

1
2
3
4
5
6
7
8
9
10
11
12
13
14
npm config set prefix "N:\soft\node-v14.0.0-win-x64\node_global"
npm config set cache "N:\soft\node-v14.0.0-win-x64\node_cache"

创建 NODE_HOME = N:\soft\node-v14.0.0-win-x64
修改path:和node相关留下下面3个即可
%NODE_HOME%
%NODE_HOME%\node_cache
%NODE_HOME%\node_global

npm config set registry https://registry.npm.taobao.org
npm install -g cnpm

npm config ls 可以查看配置路径

git

1
2
3
4
5
6
git config --global user.name "nwa"
git config --global user.email "2428284043@qq.com"

ssh-keygen -t rsa -b 4096 -C "2428284043@qq.com"
C:\Users\Administrator\.ssh

ssh 配置看http://luckynwa.top/post/6724.html

Init 项目生成本地版

cmd 打开

1
2
3
4
5
6
7
8
9
10
11
12
13
14
npm install webpack -g 再全局装
如果有问题则evering搜索npmrc文件,c盘用户名下的,删除它
运行npm install express -g
npm install hexo-cli -g 全局安装

桌面新建文件夹blog
右键gitbash输入
hexo init

生成本地页面
hexo s

http://localhost:4000/ 本地版

同步到 Github

打开_config.yml 最后一行改成下面,创建的仓库名称一定是自己的那个名称

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# Deployment
## Docs: https://hexo.io/docs/one-command-deployment
deploy:
type: git
repository: git@github.com:luckyNwa/luckyNwa.github.io.git
branch: main

在blog文件夹路径cmd输入 自动部署发布工具
npm install hexo-deployer-git --save

bash输入

hexo g 生成页面

hexo d 上传到github

https://luckynwa.github.io/ 刷新几次即可

安装主题

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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
hexo cl 清除缓存
hexo g
hexo s 这是本地预览 http://localhost:4000/
hexo d 这是同步远程

主题安装
git clone -b master https://github.com/jerryc127/hexo-theme-butterfly.git themes/butterfly

打开_config.yml修改主题
theme: butterfly

_config.yml同级别创建_config.butterfly.yml,把themes里的butterfly文件夹下的config内容复制进去

发现直接再bash里也可以直接运行npm安装pug 以及stylus的渲染器
npm install hexo-renderer-pug hexo-renderer-stylus --save

文章的URL路径就是把中文变成了一大堆字符串编码
blog打开cmd
npm install hexo-abbrlink --save

_config.yml 找到 permalink
permalink: :year/:month/:day/:title/
改成
permalink: post/:abbrlink.html
abbrlink:
alg:crc32
rep:hex


发布博客
npm i hexo-deployer-git

hexo new post "博客搭建笔记" 创建文章

hexo new page categories 创建页面

hexo cl && hexo g && hexo s 多合一生成到本地

hexo version 查看版本