hexo 个人博客工具使用教程(2)-- 选择一个主题

选择一个主题

hexo提供了很多主题供用户使用,开发者可以在主题中选择自己喜欢的主题。在这里我们选用pure作为示例,一一讲解hexo搭配主题的使用步骤

安装主题

1
2
cd {项目目录}
git clone https://github.com/cofess/hexo-theme-pure.git themes/pure

修改{项目目录}/_config.yml文件,将theme: landscape 修改为:theme: pure

更新主题

1
2
cd themes/pure
git pull

启动

1
hexo server

打开 http://localhost:4000/ 即可看见pure主题默认界面

集成github,让你的博客飞起来

目前我们已经可以在本地看到我们自己的博客了,接下来就是集成github,让我们的博客飞起来

1.安装hexo-deployer-git插件
1
npm install --save hexo-deployer-git
2. 在全局配置文件_config.yml里配置以下代码

github 使用这里就不多说了,个人认为每个开发者都应该学会使用github。在自己的github账号里创建一个项目,项目名必须是你的账号名+.github.io,例如:facebook.github.io

1
2
3
4
deploy:
type: git
repo: {你的git地址}
branch: master
3. 构建项目
1
hexo generate
4. 部署网站
1
hexo deploy
5. 查看博客

浏览器打开https://{你的github账号ID}.github.io/ 即可查看自己的博客啦