年轻爱折腾,从wordpress—>typecho—>hexo,追求越来越轻量。
网站托管于zeit+github,(zeit真香,速度相对快一些)
hexo搭建#
安装git#
sudo apt-get install gitplaintextnodejs#
sudo apt-get install nodejs
sudo apt-get install npmplaintexthexo#
npm install -g hexo-cliplaintext初始化hexo
blog是文件名
hexo init blogplaintext进入blog文件
npm installplaintext直接通过下面命令本地查看效果
hexo g
hexo serverplaintextgithub#
github 新建公开仓库
githubname.github.io
生成ssh添加到github#
git config --global user.name "yourname"
git config --global user.email "youremail"
##检查
git config user.name
git config user.email
ssh-keygen -t rsa -C "youremail"
plaintext生成.ssh 文件
id_rsa.pub复制到github—>setting—>SSH keys
下面命令检查成功与否
ssh -T git@github.complaintext部署到github#
_config.yml文件打开,最下面修改
# Docs: https://hexo.io/docs/deployment.html
deploy:
type: git
repository: git@github.com:githubname/githubname.github.io.git
branch: masterplaintext安装deploy-git
npm install hexo-deployer-git --saveplaintext# 清除生成
hexo clean
#生成静态文件
hexo g
#部署到github
hexo dplaintext添加站点地图#
npm install hexo-generator-sitemap --save #sitemap.xml google
npm install hexo-generator-baidu-sitemap --save #baidusitemap.xml百度plaintext在themes\next\layout\_partials\head.swing中添加百度站长验证代码
谷歌在https://search.google.com/search-console ↗ 添加站点信息
_config.yml 添加
sitemap:
path: sitemap.xml
baidusitemap:
path: baidusitemap.xmlplaintextRSS#
npm install hexo-generator-feed
###_config.yml
plugins: hexo-generator-feed
#Feed Atom
feed:
type: atom
path: atom.xml
limit: 20plaintextzeit托管#
为什么用zeit?
github国内访问相对较慢,所以直接托管到了zeit上面。
注册#
通过ZEIT ↗使用github登陆
导入#
Import Project 导入github博客仓库。
部署#
接着全部默认即可。
最后生成一个xxx.now.sh域名
域名修改#
cname 添加记录绑定自己域名
详细介绍可以参考帮助文档 ↗
valine#
- 注册LeanCloud ↗
- 创建新应用
- 设置 应用key 查看APP ID APP KEY
- 安全中心添加博客域名
- 修改主题的配置文件添加id 和 key