心水Hexo的NexT主题很久了,时不时看的小土刀的博客用的就是NexT主题。网上随处可见的非常Elegant的博客用的也都是NexT主题。这使得我非常想要一个NexT主题的博客,最近终于有时间实现这一愿望了。
Step 1 GitHub Pages
创建Repository
在Github创建一个Repository,名字格式是username.github.io 。

打开博客
点击Settings > GitHub Pages > Choose a theme,这里选择Cayman。

在它跳转的界面点击 Commit changes 按钮,这样网站就可以访问了。

打开https://yalinma.github.io/ ,确认网站可以正常打开。

Step 2 Hexo
Hexo是一个简单、强大的博客框架。
安装Hexo
npm install hexo-cli -g
hexo init blog
cd blog
npm install
hexo server
打开http://localhost:4000/ ,确认Hexo安装OK。

安装Next主题
使用以下命令,安装NexT主题。
git clone https://github.com/theme-next/hexo-theme-next themes/next
修改Hexo配置文件 _config.yml。
theme: next
运行hexo server,打开http://localhost:4000/ ,确认主题安装OK。

Step 3 首次发布内容
在Hexo上创建内容
生成一个文件名为使用GitHub Pages 和 Hexo 搭建博客的markdown文件。
hexo new "使用GitHub Pages 和 Hexo 搭建博客"
编辑内容
在电脑上打开blog > source >_posts,打开使用GitHub Pages 和 Hexo 搭建博客.md,往里面写入内容。
部署Hexo中的内容到Github
npm install hexo-deployer-git --save
修改_config.yml文件
deploy:
type: git
repo: git@github.com:yalinma/yalinma.github.io.git #这里使用的是SSH repo url,原因见参考[3]
branch: master
部署到Github
./node_modules/.bin/hexo clean && ./node_modules/.bin/hexo deploy
打开你的博客https://yalinma.github.io/ ,确认内容发布OK。

Step 4 平时发布内容
只需要创建、编辑及部署到Github。
创建内容
hexo new "你的文章标题"
编辑内容
在电脑上打开blog > source >_posts,打开你的文章标题.md,往里面写入内容。
部署到Github
./node_modules/.bin/hexo clean && ./node_modules/.bin/hexo deploy
打开你的博客https://yalinma.github.io/ ,确认发布OK。
参考


