As mentioned elsewhere, I use Hexo as my static site framework. It does most of what I want out of the box, and it has plugins for most everything else.
On my homepage I’ve embedded the SoundCloud widget in a Bootstrap flexbox. But it would be nice to put audio directly into a blog post as well, without too much hacking. Fortunately, Hexo has plenty of audio plugins available, and in less time than it took to write this post I added a couple.
Aplayer
The installation of hexo-tag-aplayer
is straightforward using the documentation on its Github page. Inserting the player is pretty much a cinch, but I hit a wrinkle: I can’t figure out how to make the audio not loop by default. Personally I find auto-looping second to only autoplay in terms of internet annoyances, so it was important that I overcome it.
After struggling with this a few minutes I hit upon an unseemly solution: I would insert a playlist, even it only contains one track, so that I might take advantage of the loop
keyword. So my template expression winds up looking like:
1 | {% aplayerlist %} |
Which produces:
SoundCloud
Right now I host all my songs on SoundCloud. The hexo-soundcloud plugin is pretty good. The default player looks like:
Spotify
What easier way to reference a song than embed a link to the ubiquitous Spotify. And, yes, there is a Hexo plugin for it:
And More‽[1]
I don’t know if Hexo has plugins for every audio use-case, but the certainly have plugins sufficient for my audio use-cases. Writing a Hexo plugin sounds like it could be a fun project but, in this case, I see no cause for it. I’m very content with the open-source tools available.[2]