来做个自己的hexo博客吧(1)

借助github pages和hexo,可以很方便的搭建起美观而又简洁的博客,还可以随时更改博客界面,添加各种实用的插件进行进一步的美化。本文为搭建博客步骤的简要介绍^_^。

创建github账号,新建repo,命名应与账号名相同

配置gitbash中的ssh

任意新建一个文件夹用于存放博客和更新博客

不需要clone下来第一步新建的repo,但建议的方式是在repo中新建分支保存用于生成博客的文件夹

1
2
3
4
5
6
7
npm install -g hexo-cli # 安装hexo
cd (你的文件夹)
hexo init
npm install
# 通过以上步骤即可初始化完成
hexo server # 本地查看部署好的网站
npm install hexo-deployer-git --save # 为第五步步骤做准备

打开_config.yml,修改最后一部分

1
2
3
4
deploy:
type: git
repo: git@github.com:Freyr-Wings/Freyr-Wings.github.io.git
branch: master

输入命令部署网站

1
hexo g -d # deploy,将搭建好的网站部署到github.io上

下载主题

a-例子-yilia

link: https://github.com/litten/hexo-theme-yilia

1
git clone https://github.com/litten/hexo-theme-yilia.git themes/yilia

克隆完成后每次更新只需要在文件夹内git pull即可

b-Rank

主题排行(from知乎):https://www.zhihu.com/question/24422335

1
git clone --branch v5.1.2 https://github.com/iissnan/hexo-theme-next themes/next

c-viosey-material

文档:https://material.viosey.com/docs/#/start

1
git clone https://github.com/viosey/hexo-theme-material.git themes/material

EXTRA

输入hexo d后,如果发现配置失败,请直接打开.deploy_git文件夹,通过git push origin master 的方式进行尝试和debug

0%