准备环境:
- node.js
- git
安装步骤
-
安装hexo-cli
$ npm install -g hexo-cli -
建立一个新的文件夹来作为博客的目录
$ mkdir blog -
初始化博客
$ sudo hexo init # windows下直接使用 hexo init -
启动博客
hexo server # 可简写:hexo s
至此,一个博客就搭建完成了
新建文章
-
新建文章
hexo new '文章名' # 可简写: hexo n '文件名' -
清理
hexo clean -
重新生成静态文件
hexo generate # 可简写: hexo g
部署到服务器(或github等代码托管平台)
将博客部署到github上
-
在github上创建自己的主页(项目名与自己用户名一致)
-
安装git部署插件
$ npm install --save hexo-deployer-git -
设置博客目录内 _config.yml文件
修改最下面内容deploy: type: git repo: 仓库地址 branch: master -
部署到远端
$ hexo d
设置主题
-
找到心仪的主题 , 例:https://github.com/litten/hexo-theme-yilia
-
将主题拷贝到主题目录
git clone 主题地址 themes/主题名 -
修改配置文件 _config.yml(大概第87行)
theme: 主题名(默认是landscape) -
重新清理,创建,部署
浙公网安备 33010602011771号