前提

在上篇文章我写了其中一种解决方法,但思考本质原因是我用了一图流后,我重新查看代码,终于发现了最终解决方案,不废话直接说结论。

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

解决方法以及思路

进入[BlogRoot]\themes\butterfly\layout\includes\layout.pug文件中(BlogRoot为根目录)。

之前我使用了别的博主的一图流再加pages页单图,修改成大概这样子

最终通过console发现我输入的值都是正常的,就是这个#web_bg无法创建出来,所以我怀疑不给予参数是无法根据默认参数生成,所以我模仿page页面的写法重新给默认的#web_bg赋值。

1
2
3
4
5
if theme.background
if page.background
#web_bg(style=`background:`+ page.background + `;background-attachment: local;background-position: center;background-size: cover;background-repeat: no-repeat;`)
else
#web_bg(style=`background:`+ theme.background + `;background-attachment: local;background-position: center;background-size: cover;background-repeat: no-repeat;`)

最终hexo博客主页面终于显示成功background了。

ps.解决方法仅供参考