Butterfly魔改9:添加音乐播放器
安装插件
1、安装 npm install --save hexo-tag-aplayer
如果出现npm ERR! enoent ENOENT: no such file or directory, rename 'E:\Blog\node_modules\safe-regex-test' -> 'E:\Blog\node_modules\.safe-regex-test.DELETE'
等错误,尝试清除缓存npm cache clean --force
,然后再重新安装
2、安装 npm install meting@2.0.1 --save
不然后续会报错Error: [hexo-tag-aplayer] Meting support is disabled, cannot resolve the meting tags properly.
修改配置文件
在主题内层的_config.yml
中找到对应部分修改为如下:
# Inject the css and script (aplayer/meting) |
然后在最外层,也就是hexo本体的_config.yml最后面加上如下
aplayer: |
引用格式
我试的html格式的引用不了,但是我的要求不高,就用大括号来引用了
{% meting "2644823537" "netease" "song" "listmaxheight:400px" "theme:#2A6E3F"%} |
使用{% meting %}
的参数如下
Option | Default | Description |
---|---|---|
id | required | song id / playlist id / album id / search keyword |
server | required | Music platform: netease , tencent , kugou , xiami , baidu |
type | required | song , playlist , album , search , artist |
fixed | false |
Enable fixed mode |
mini | false |
Enable mini mode |
loop | all |
Player loop play, values: ‘all’, ‘one’, ‘none’ |
order | list |
Player play order, values: ‘list’, ‘random’ |
volume | 0.7 | Default volume, notice that player will remember user setting, default volume will not work after user set volume themselves |
lrctype | 0 | Lyric type |
listfolded | false |
Indicate whether list should folded at first |
autoplay | false |
Autoplay song(s), not supported by mobile browsers |
mutex | true |
Pause other players when this player playing |
listmaxheight | 340px |
Max height of play list |
preload | auto |
The way to load music, can be none , metadata , auto |
storagename | metingjs |
LocalStorage key that store player setting |
theme | #ad7a86 |
Theme color |
更多内容可翻看hexo-tag-aplayer的官方文档
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来源 Diraw's World!
右侧切换GitHub或邮箱评论
GiscusTwikoo