惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - 三生石上(FineUI控件)
月光博客
月光博客
人人都是产品经理
人人都是产品经理
Google DeepMind News
Google DeepMind News
M
MIT News - Artificial intelligence
Vercel News
Vercel News
MyScale Blog
MyScale Blog
爱范儿
爱范儿
博客园 - 司徒正美
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
IT之家
IT之家
H
Help Net Security
Last Week in AI
Last Week in AI
阮一峰的网络日志
阮一峰的网络日志
酷 壳 – CoolShell
酷 壳 – CoolShell
L
LangChain Blog
罗磊的独立博客
Stack Overflow Blog
Stack Overflow Blog
宝玉的分享
宝玉的分享
博客园 - 聂微东
云风的 BLOG
云风的 BLOG
J
Java Code Geeks
博客园 - 叶小钗
D
Docker

Butterfly

Butterfly 5.6 Release Notes Butterfly 5.5 Release Notes Butterfly 5.4 Release Notes Butterfly 5.3 Release Notes Butterfly 5.2 Release Notes Butterfly 5.1 Release Notes Butterfly 5.0 Release Notes Butterfly 4.13 Release Notes Butterfly 4.12 Release Notes Butterfly 4.11 Release Notes Butterfly 4.10 Release Notes Butterfly Changelog Butterfly document - Advanced Tutorial Butterfly document - Q&A Butterfly document - Tag Plugins Butterfly document - Theme Configuration Butterfly document - Theme Pages Butterfly document - Get Started Custom Sidebar When Setting top_img to false Customize code coloring no cover Tag Plugins Markdown Style test
Alternative Methods After Butterfly Removes Built-in APla...
Jerry · 2026-08-02 · via Butterfly

Introduction

This theme has removed support for the built-in APlayer / Meting music player. If you previously injected a player into your site via the theme (e.g., music page, in-article player, floating player), these players will no longer be automatically loaded by the theme after updating.

This article explains:

  • What was affected by the removal
  • How to use alternative methods if you still want to keep using it
  • How to completely clean up leftover resources if you no longer need it

1. What Was Removed

The following code was removed at the theme level (if your site does not use a player at all, you don't need to handle any of this):

  1. themes/butterfly/layout/includes/third-party/aplayer.pug
    • Previously responsible for loading APlayer CSS, APlayer.js, and Meting.js, and handling player destroy/re-init on pjax page transitions.
  2. themes/butterfly/layout/includes/additional-js.pug
    • Previously conditionally included the above file based on aplayer & aplayerInject, now removed.
  3. themes/butterfly/source/css/_layout/third-party.styl and darkmode.styl
    • .aplayer layout styles and dark mode adjustments.
  4. themes/butterfly/scripts/common/default_config.js
    • aplayerInject default configuration.
  5. themes/butterfly/plugins.yml
    • aplayer_css, aplayer_js, meting_js CDN resource declarations.

Summary of impact:

  • The front-matter variable aplayer: true is now ineffective.
  • The aplayerInject config (site-wide injection) is now ineffective.
  • <div class="aplayer" ...> in articles or pages will not display the player unless you import the resources yourself (it will show a blank or unchanged div).

2. I Want to Keep Using It — What Should I Do?

The theme no longer loads the player for you, but you can simply import the resources yourself. Below is an alternative approach.

Site-wide Injection via inject (Simplest)

Add the following to the inject section in _config.butterfly.yml:

1
2
3
4
5
6
inject:
head:
- '<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/aplayer@1.10.1/dist/APlayer.min.css">'
bottom:
- '<script src="https://cdn.jsdelivr.net/npm/aplayer@1.10.1/dist/APlayer.min.js"></script>'
- '<script src="https://cdn.jsdelivr.net/npm/meting@2.0.1/dist/Meting.min.js"></script>'

Note: The inject keys in this theme are head / bottom (inserted before </head> and </body> respectively).

Then add the player HTML on the desired page:

1
<div class="aplayer" data-id="60198" data-server="netease" data-type="playlist" data-autoplay="true" muted></div>

If you have pjax enabled, the player may not automatically re-initialize when switching pages. Add the following script to the bottom inject:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<script>
var __runMeting = function () {

if (window.aplayers) {
try { window.aplayers.forEach(function (p) { if (!p.options.fixed) p.destroy(); }); } catch (e) {}
}

if (typeof loadMeting === 'function' && document.getElementsByClassName('aplayer').length) {
loadMeting();
}
};
window.addEventListener('load', __runMeting);
document.addEventListener('pjax:complete', __runMeting);
</script>

Adding Back the .aplayer Styles

The theme also removed the .aplayer layout styles. If you want the player to look the same as before, add the following <style> to the head inject (includes appearance fixes for the playlist when beautify.enable is turned on):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<style>
.aplayer {
color: #4c4948;
}
.container .aplayer {
margin: 0 0 20px;
}

.container .aplayer ol,
.container .aplayer ul {
margin: 0;
padding: 0;
}
.container .aplayer li {
margin: 0;
padding: 0 15px;
}
.container .aplayer li::before {
content: none;
}
</style>

If you use dark mode, you can also add the original dark mode adjustment:

1
2
3
.aplayer {
filter: brightness(.8);
}

These styles are optional — they only make the player appearance more consistent with the original theme. Not adding them won't affect player functionality.

Advanced approach: You can also install the hexo-tag-aplayer tag plugin to embed players via tag plugins, which is easier to maintain than modifying theme files directly.


3. No Longer Needed — How to Clean Up Completely?

If you decide to stop using the player, check and clean up the following:

  1. Config removal: _config.butterfly.yml
    • Remove the aplayerInject section (if it exists).
    • Remove any APlayer / Meting <link> / <script> you added to inject.
    • If you had a Music: /music/ navigation item, remove it as well.
  2. Pages and articles:
    • Delete the music page (source/music/).
    • Search for <div class="aplayer"...>, aplayer:, meting: in all articles and remove them.
  3. Use the checklist from Section 1 to confirm no leftovers remain, and clean them up one by one.

4. Post-Update Self-Check

If you find that "the player was there before but now it's gone" after updating the theme, check the following in order:

  • Does _config.butterfly.yml (and the theme _config.yml) still contain aplayerInject / Music menu?
  • Do articles and pages still have <div class="aplayer"> tags?
  • Have you added APlayer and Meting resources yourself via inject (or HEAD/BODY)?
  • If pjax is enabled, is loadMeting() being re-called on pjax:complete?

After completing these steps, the player should work normally and match your desired configuration.