Hexo Hello World
参考
建站思路
- 在域名提供商处申请个性化的域名
- 搭建本地环境 NodeJS + Hexo + 选用主题,部署到 Github
- Github 已经提供私有仓库
将环境同步到 Bitbucket 的私有仓库,保证随时随地使用Bitbucket 面向个人提供免费私有的仓库,最适合折腾一些小东西使用。
实际操作
我使用的主题是 polarbear,这里记录下使用过程中的一些坑。
先安装Git,再安装NodeJS,将pnm的源设为淘宝源,然后使用npm的方式安装Hexo与Yarn。接着Hexo初始化,将你打算用的主题clone到${your_hexo_blog}/themes 下。设置如下源,避免网络原因导致下载失败:
1
2
3npm config set registry https://registry.npm.taobao.org/
yarn config set registry https://registry.npm.taobao.org/
yarn config set sass-binary-site http://npm.taobao.org/mirrors/node-sass安装顺序
1
2
3sudo apt install nodejs -g
sudo npm install hexo -g
sudo npm install yarn -g修改配置文件 _config.yml 的过程中,注意保持key/value之间的空格,否则会报莫名奇妙的错误
使用SSH方式部署到Github时,注意将本地生成的SSH Public key添加到合适位置。否则只有只读权限,提交更新时报错
具体环境ubuntu 20.04:Ubuntu已安装的cmdtest,yarn受cmdtest影响,需要移除cmdtest之后再安装之后。