使用 Hexo 搭建静态博客教程
安装前准备
安装与配置
打开 Git Bash
安装 Hexo
$ npm install -g hexo-cli初始化 Hexo
$ hexo init blogblog为 Hexo 目录,可自行指定 。
生成静态文件
$ cd blog
$ npm install
$ hexo g启动服务器
$ hexo s访问网址http://localhost:4000/,可查看网页有无问题,无问题即可进行部署。
部署服务器
$ hexo d常用插件
搜索插件
$ npm install hexo-generator-search --save基本所有使用本地搜索的主题都需要安装,比如NexT主题。
渲染插件
$ npm install hexo-renderer-pug --save
$ npm install hexo-renderer-sass --saveMaupassant主题必须安装。
注意事项
1.修改配置后需要重新部署
$ hexo clean
$ hexo g
$ hexo d2.部署时报错处理hexo d时报错error deployer not found:git,执行
$ npm install hexo-deployer-git --save