利用hexo和gitee pages构建个人主页

node npm 配置拉取node依赖

1
2
3
4
5
npm install --registry=https://registry.npm.taobao.org 
npm config set registry https://registry.npm.taobao.org

## 恢复官方镜像
npm config set registry https://registry.npmjs.org

选用的主题:https://github.com/probberechts/hexo-theme-cactus

hexo vscode报错解决

hexo s ,vscode报错 :无法加载文件 C:\Users\Administrator\AppData\Roaming\npm\hexo.ps1,因为在此系统中禁止执行脚本。

1
2
3
4
执行:get-ExecutionPolicy,返回状态:Restricted,表示状态是禁止的,
然后要设置下
执行:set-ExecutionPolicy RemoteSigned 开启
选择Y

hexo 图片资源不显示

npm install hexo-asset-image –save 插件安装:https://github.com/xcodebuild/hexo-asset-image

使用 Hexo-asset-image 插件静态图片路径会变成一个错误的路径.解决方法如下:

cd node_modules/hexo-asset-image/
vim index.js
在 59 行附近, 将以下代码替换掉

1
2
3
4
// $(this).attr('src', config.root + link + src);
// console.info&&console.info("update link as:-->"+config.root + link + src);
$(this).attr('src', data.permalink +src);
console.info&&console.info("update link as:-->" + data.permalink + src);

除了直接修改代码,也可以使用另一个资源:https://github.com/yiyungent/hexo-asset-img

1
2
3
#先卸载原来的图片展示插件
npm uninstall hexo-asset-image
npm install hexo-asset-img --save