美文网首页
Hexo博客网易云音乐播放器

Hexo博客网易云音乐播放器

作者: willcoder | 来源:发表于2019-06-19 01:05 被阅读0次

    1、打开网易云音乐首页,复制选择的背景音乐分享外链网易云音乐

    网易云音乐
    2、引入播放器代码

    在themes/yilia/layout/_partial/left-col.ejs文件nav标签中添加代码
    

    注:放在<nav class="header-nav">和</nav>之内
    笔者添加了一些判断和表达式

    <!-- 网易云音乐插件 -->
    <% if (theme.music && theme.music.enable){ %>
        <div style="position:absolute; bottom:120px left:auto; width:85%">
            <iframe frameborder="no" border="0" marginwidth="0" marginheight="0" width="240" height="52" src="//music.163.com/outchain/player?type=2&id=<%=theme.music.id||1334445174%>&auto=<%=theme.music.autoplay?1:0%>&height=32"></iframe>
        </div>
    <% } %>
    
    

    3、在yilia主题配置文件中添加属性

    # 网易云音乐插件
    music:
      enable: true
      #id: 1332647902  # 网易云分享的ID
      autoplay: true  # 是否开启自动播放
    

    相关文章

      网友评论

          本文标题:Hexo博客网易云音乐播放器

          本文链接:https://www.haomeiwen.com/subject/dheytctx.html