hexo插入Aplayer插件

Aplayer是diygod大佬开始的一个开源项目,用来给网页加载播放器,我是大概一年前发现的这个项目,当时就加在了老博客上,但是当我把博客转到hexo后直接用的hexo的theme,就没有在意hexo的实现,所以便没有加入,然后发现了这个Aplayer插件= =

开发与维护者是grzhan

https://github.com/MoePlayer/hexo-tag-aplayer

下面是一个效果演示


        

我觉得很ok,什么时候才能成为大佬啊,熬不住了啊: - (

然后看看配置和加载办法(当然上面的链接下面有开发文档)

配置和加载办法

首先要安装hexo-tag-aplayer,在博客大文件夹下运行

1
npm install --save hexo-tag-aplayer

然后用

1
hexo new "name"

新建一个markdown文档

在文档下写入

1
{% aplayer title author url [picture_url, narrow, autoplay, width:xxx, lrc:xxx] %}

如果是多个,可以用播放器

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
{% aplayerlist %}
{
"narrow": false, // (可选)播放器袖珍风格
"autoplay": true, // (可选) 自动播放,移动端浏览器暂时不支持此功能
"mode": "random", // (可选)曲目循环类型,有 'random'(随机播放), 'single' (单曲播放), 'circulation' (循环播放), 'order' (列表播放), 默认:'circulation'
"showlrc": 3, // (可选)歌词显示配置项,可选项有:1,2,3
"mutex": true, // (可选)该选项开启时,如果同页面有其他 aplayer 播放,该播放器会暂停
"theme": "#e6d0b2", // (可选)播放器风格色彩设置,默认:#b7daff
"preload": "metadata", // (可选)音乐文件预载入模式,可选项: 'none' 'metadata' 'auto', 默认: 'auto'
"listmaxheight": "513px", // (可选) 该播放列表的最大长度
"music": [
{
"title": "CoCo",
"author": "Jeff Williams",
"url": "caffeine.mp3",
"pic": "caffeine.jpeg",
"lrc": "caffeine.txt"
},
{
"title": "アイロニ",
"author": "鹿乃",
"url": "irony.mp3",
"pic": "irony.jpg"
}
]
}
{% endaplayerlist %}

看看播放器的效果