前提 :前端时间在搭建hexo的使用butterfly主题后想参考一图流去修改背景图,发现按说明修改完后,background怎么修改地址,无论是本地还是链接都无法显示出来,后来经排查后发现是缺了文件,所以这里提出来一个解决思路,如若不行还请继续努力。

  • 背景:
  • hexo butterfly 5.2.2
  • github
  • cloudflare page

解决方法

进入[BlogRoot]\themes\butterfly\source\css\var.styl文件中(BlogRoot为根目录)。

在大概35行的位置查看$text-line-height = 2$index_top_img_height = hexo-config('index_top_img_height') ? convert(hexo-config('index_top_img_height')) : 100vh之间是否有如下代码

1
2
3
$text-line-height = 2
$web-bg = hexo-config('background') && unquote(hexo-config('background')) //查看是否有这行
$index_top_img_height = hexo-config('index_top_img_height') ? convert(hexo-config('index_top_img_height')) : 100vh

如果没有的话

补上$web-bg = hexo-config('background') && unquote(hexo-config('background'))

再重新hexo cl && hexo g && hexo d应该就可以显示了。

ps.解决方法仅供参考