搭建hexo博客遇到的问题
搭建hexo博客遇到的问题
- 常用命令
- hexo clean 清除hexo缓存
- hexo generate 生成文章
- hexo deploy 部署
- hexo new post name 新建文章名
- hexo new page name 新建页面名
hexo clean && hexo generate && hexo deploy hexo cl && hexo g && hexo d - deploy时git报错
error:RPC failed;curl 56 OpenSSL SSL_read: Connectionwas reset,errno 10054
SSL证书问题或者git中版本问题
解决办法:- 删除掉.deploy_git重新clean、g、d
- 挂代理
- 删除掉本地的ssh key并重新生成,添加到github中
- 在文章中添加图片失败
使用asset_img在文章中添加图片,需要修改_config.xml
asset_img在新建文章时会自动新建同名文件夹,需要添加图片时,只需将图片放入文件夹中,引入方式为:post_asset_folder: true
引入后发现图片地址被解析为(.io/20/02/........),图片地址不正确,原因是asset未更新,导致遗留bug,修改 node_modules/hexo-asset-image/index.js,
60行附近,// $(this).attr('src', config.root + link + src); //修改前 $(this).attr('src',data.permalink+src); //修改后 // console.info&&console.info("update link as:-->"+config.root + link + src); console.info&&console.info("update link as:-->"+data.permalink+src); - md中插入数学公式问题
- 安装kramed
npm uninstall hexo-renderer-marked --save npm install hexo-renderer-kramed --save- 修改配置
在_config.xml中添加
kramed: gfm: true pedantic: false sanitize: false tables: true breaks: true smartLists: true smartypants: true- 修改主题配置文件
enable:开启truemathjax: enable: true per_page: false
per_page:是否选择每页都开启公式支持,true时,每篇文章都会引入mathjax.js,false时,需要引入时,需要在该文章fronter中写入mathjax:true,不需要引入时可减少加载资源。- 修改node_modules\kramed\lib\rules\inline.js
在使用行间公式和行内公式会存在一些冲突,需要修改此文件
//line11 // escape: /^\\([\\`*{}\[\]()#$+\-.!_>])/, escape: /^\\([`*\[\]()#$+\-.!_>])/, //line20 // em: /^\b_((?:__|[\s\S])+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/, em: /^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,

浙公网安备 33010602011771号