安装aplayer

1
sudo npm install --save hexo-tag-aplaye

添加aplayer.pug

  • 在Maupassant主题路径增加aplayer.pug文件
    路径为themes/maupassant/layout/_widget/aplayer.pug,文件内容如下
1
2
3
4
5
6
7
#其中data-id编号为网易云音乐的歌单ID
.widget
link(rel="stylesheet", type='text/css', href="https://cdn.jsdelivr.net/npm/aplayer@1.10/dist/APlayer.min.css")
script(type='text/javascript', src="https://cdn.jsdelivr.net/npm/aplayer@1.10/dist/APlayer.min.js")
script(type='text/javascript', src="https://cdn.jsdelivr.net/npm/meting@1.2/dist/Meting.min.js")

div(class="aplayer", data-id="2673046384" ,data-server="netease" ,data-type="playlist" ,data-listmaxheight="98px",data-theme="#FF4081")

修改Maupassant主题配置文件

themes/maupassant/_config.yml , 在widgets标签下增加aplaye ,修改如下:

1
2
3
4
5
6
7
8
9
widgets: ## Seven widgets in sidebar provided: search, info, category, tag, recent_posts, recent_comments and links.
- aplayer
- search
# - info
- category
- tag
- recent_posts
- recent_comments
- links

部署blog

1
2
3
4
hexo clean
hexo g
hexo d
hexo s