hexo部署到服务器之后图片无法访问问题
问题描述:
hexo本地截图之类的图片,本地部署可以访问,但是部署到服务器之后无法显示,因为图片并没有传到服务器上面或者路径有问题。
解决办法:
首先:安装一个图片路径转换的插件,这个插件名字是hexo-asset-image
npm install hexo-asset-image --save
但是这个插件的内容需要修改【不然可能会出Bug】
打开/node_modules/hexo-asset-image/index.js,将内容更换为下面的代码
'use strict';
var cheerio = require('cheerio');
// http://stackoverflow.com/questions/14480345/how-to-get-the-nth-occurrence-in-a-string
function getPosition(str, m, i) {
return str.split(m, i).join(m).length;
}
var version = String(hexo.version).split('.');
hexo.extend.filter.register('after_post_render', function(data){
var config = hexo.config;
if(config.post_asset_folder){
var link = data.

最低0.47元/天 解锁文章
2444

被折叠的 条评论
为什么被折叠?



