next主题如何添加动态背景canvas_nest

hexo next主题下怎么添加canvas_nest背景

我的hexo next是V7.5.0版本

  1. 修改主题配置文件
    打开 /next/_config.ymlCtrl+f找到Canvas-nest,将enable改为true
    1
    2
    3
    4
    5
    # Canvas-nest
    # Dependencies: https://github.com/theme-next/theme-next-canvas-nest
    # For more information: https://github.com/hustcc/canvas-nest.js
    canvas_nest:
    enable: true
    接下来有两种方法:
    方法一:修改布局文件
    打开 next/layout/_layout.swig,在<body></body>标签内添加以下代码
    1
    2
    3
    4
    5
    {% if theme.canvas_nest %}
    <script type="text/javascript"
    src="//cdn.bootcss.com/canvas-nest.js/1.0.0/canvas-nest.min.js">
    </script>
    {% endif %}
    方法二:下载插件canvas-nest
    1
    2
    git clone https://github.com/theme-next/theme-next-canvas-nest
    themes/next-v7.5.0/source/lib/canvas-nest
    然后运行以下代码重新构建
    1
    hexo clean && hexo g && hexo s