Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
H

hexo-tag-aplayer

> 编程语言
Open source

Embed aplayer in Hexo posts/pages

751 stars0 likes1 views
WebsiteGitHub

About

Embed aplayer in Hexo posts/pages

hexo-tag-aplayer

Embed APlayer(https://github.com/DIYgod/APlayer) in Hexo posts/pages.

中文文档

  • Installation
  • Dependency
  • Usage
    • Option
    • With lyrics
    • With playlist
    • MeingJS support (new in 3.0)
    • PJAX compatible
  • Customization (new in 3.0)
  • Troubleshoot
    • Space within arguments
    • Duplicate APlayer.JS loading
  • LICENSE

Installation

bash
npm install --save hexo-tag-aplayer

Dependency

  • APlayer.js >= 1.10.0
  • Meting.js >= 1.2.0

Usage

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

Option

  • title : music title
  • author: music author
  • url: music file url
  • picture_url: optional, music picture url
  • narrow: optional, narrow style
  • autoplay: optional, autoplay music, not supported by mobile browsers
  • width:xxx: optional, prefix width:, player's width (default: 100%)
  • lrc:xxx: optional, prefix lrc:, LRC file url

With post asset folders enabled, you can easily place your image, music and LRC file into asset folder, and reference them like:

{% aplayer "Caffeine" "Jeff Williams" "caffeine.mp3" "picture.jpg" "lrc:caffeine.txt" %}

With lyrics

Besides 'lrc' option, you can use aplayerlrc which has end tag to show lyrics.

{% aplayerlrc "title" "author" "url" "autoplay" %}
[00:00.00]lrc here
{% endaplayerlrc %}

With playlist

{% aplayerlist %}
{
    "narrow": false,                          // Optional, narrow style
    "autoplay": true,                         // Optional, autoplay song(s), not supported by mobile browsers
    "mode": "random",                         // Optional, play mode, can be `random` `single` `circulation`(loop) `order`(no loop), default: `circulation`
    "showlrc": 3,                             // Optional, show lrc, can be 1, 2, 3
    "mutex": true,                            // Optional, pause other players when this player playing
    "theme": "#e6d0b2",	                      // Optional, theme color, default: #b7daff
    "preload": "metadata",                    // Optional, the way to load music, can be 'none' 'metadata' 'auto', default: 'auto'
    "listmaxheight": "513px",                 // Optional, max height of play list
    "music": [
        {
            "title": "CoCo",
            "author": "Jeff Williams",
            "url": "caffeine.mp3",
            "pic": "caffeine.jpeg",
            "lrc": "caffeine.txt"
        },
        {
            "title": "アイロニ",
            "author": "鹿乃",
            "url": "irony.mp3",
            "pic": "irony.jpg"
        }
    ]
}
{% endaplayerlist %}

MeingJS support (new in 3.0)

When you use MetingJS, your blog can play musics from Tencent, Netease, Xiami, Kugou, Baidu and more.

See metowolf/MetingJS and metowolf/Meting in detail.

If you want to use MetingJS in hexo-tag-aplayer, you need enable it in _config.yml

yaml
aplayer:
  meting: true

Now you can use {% meting ...%} in your post:


{% meting "60198" "netease" "playlist" %}

{% meting "60198" "netease" "playlist" "autoplay" "mutex:false" "listmaxheight:340px" "preload:none" "theme:#ad7a86"%}

The {% meting %} options are shown below:

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

Read section customization to learn how to configure self-host meting api server in hexo-tag-aplayer and other configuration.

PJAX compatible

You need destroy APlayer instances manually when you use PJAX.

javascript
$(document).on('pjax:start', function () {
    if (window.aplayers) {
        for (let i = 0; i `:

```html

  
    ...
    

    

  
  ...

…

yaml
aplayer:
  asset_inject: false

LICENSE

MIT

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

JavaScripthexomusicplayerplugin

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言