博客文档

记录一下搭建这个博客的文档

快速开始

安装Hexo

局部安装hexo

1
npm install hexo

把局部安装的执行文件目录加入环境变量

1
echo 'PATH="$PATH:./node_modules/.bin"' >> ~/.profile

安装安知鱼主题

1
git clone -b main https://github.com/anzhiyu-c/hexo-theme-anzhiyu.git themes/anzhiyu

或者,如果你的博客也在一个git仓库里

1
git submodule add https://github.com/anzhiyu-c/hexo-theme-anzhiyu.git themes/anzhiyu

把Hexo根目录下的config.yml里的theme改成anzhiyu

1
theme: anzhiyu

安装pug和stylus

1
npm install hexo-renderer-pug hexo-renderer-stylus --save

覆盖配置

1
cp -rf ./themes/anzhiyu/_config.yml ./_config.anzhiyu.yml

写博客

1
hexo new "博客文章"

然后去source/_posts/找到刚刚创建的markdown文件,用你喜欢的文本编辑器写博客

结束之后,构建博客

1
npm run build

把Hexo根目录里刚刚生成出来的public文件夹复制到nodejs运行的服务器根目录

1
cp -rf ./public ~/domains/example.com/public_nodejs/