hexo發(fā)布博客時,文章中引用的本地圖片總是無法顯示。
hexo默認(rèn)無法處理文章插入本地圖片德频,需要通過擴展插件支持。
插件安裝與配置
1缩幸、我們需要安裝一個圖片路徑轉(zhuǎn)換的插件壹置,插件名字為hexo-asset-image,只需執(zhí)行以下命令
cd /d 你的hexo根目錄
npm install https://github.com/7ym0n/hexo-asset-image --save
2表谊、打開hexo根目錄下的_config.yml文件钞护,修改下述內(nèi)容
post_asset_folder: true
# URL
## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
url: http://yourname.github.io
博文插入本地圖片
運行hexo n "你的博文名字"
生成md博文時,/source/_posts目錄下會生成一個與md同名的文件夾爆办,將圖片放人該文件夾难咕。
使用! [](你的博文名字/圖片名稱)插入圖片即可。