挑选主题
挑选Hexo主题,大概花了2个小时,没错就是这么多。
由于next主题用的人太多,很简洁,我又喜欢花里胡哨的,所以pass掉了。
大概确定了10个左右的主题,然后从这些里边在挑选。
第一个:https://hexo.io/zh-cn/docs/themes,首页存在样式的BUG

第二个:https://longlongyu.github.io/,有点少女系。

第三个:https://sakura.hojun.cn/做的非常好,就是功能太多了。

后边还有很多:
坏掉的番茄

喵绪

我再这里

第一眼看到https://nexmoe.com/这个模板,就感觉很简洁大方同时又能满足我文章图片的展示风格,所以就它了。

更换主题
hexo
前提是装好hexo,必要条件,nodejs,npm
虽然nodejs中自带npm,但是还是有必要再安装一下,因为nodejs中的npm不是最新的。
安装nodejs和npm的文章见https://www.jianshu.com/p/6f50ec69c7d6
下载
你可以自己决定想要使用的分支;使用 Git 下载 nexmoe 以后还可以使用 git pull 更新 nexmoe。
cd themes
git clone https://github.com/nexmoe/hexo-theme-nexmoe.git nexmoe
cd nexmoe
git checkout {branch/tags name/commit hash}
安装
其他主题不同,安装 Nexmoe 需要额外的步骤;主题默认已经集成了文章【字数统计】、【阅读时长】统计功能,且暂时无法关闭。如果没有安装 hexo-wordcount 插件,先安装该插件:
npm i --save hexo-wordcount
Node 版本 7.6.0 之前,请安装 2.x 版本 (Node.js v7.6.0 and previous) ,安装命令如下:
npm install hexo-wordcount@2 --save
同时你需要把nexmoe主题目录下的 _config.example.yml 复制一份并把副本重命名为 _config.yml。
cp -i _config.example.yml _config.yml
因为在主题的开发迭代过程中,主题的配置文件 很有可能会有变动。所以我们把 _config.yml 添加到了 .gitignore 之中,这样可以避免使用 git pull 更新主题的用户出现冲突。
启用 Nexmoe
在站点根目录下运行下面的命令在本地启动一个 Hexo Server。
hexo s --debug
在服务启动的过程,注意观察命令行输出是否有任何异常信息,如果你碰到问题,这些信息将帮助他人更好的定位错误。
当命令行输出下述内容时说明 Hexo 已经监听在本机的 4000 端口,使用浏览器访问 http://localhost:4000
域名绑定
1购买自己的域名
我在阿里云购买的的https://www.aliyun.com/?utm_content=se_1003074876
购买完成需要备案。
2解析
找到仓库的ip

登录阿里云,选择控制台

选择域名

进行解析

需要添加2个记录一个是www另一个是@,可查看新手引导,记录值为刚才ping的仓库ip

登录github仓库,创建CNAME文件,文件内容为你的域名

文件里填写的内容:要绑定的域名(不要包含Http://和www)
到此结束。
网友评论