https://github.com/deuill/hugo-module-listenbrainz
A Hugo module for including a 'Now Playing' widget on your site, powered by ListenBrainz
https://github.com/deuill/hugo-module-listenbrainz
hugo hugo-module listenbrainz
Last synced: 26 days ago
JSON representation
A Hugo module for including a 'Now Playing' widget on your site, powered by ListenBrainz
- Host: GitHub
- URL: https://github.com/deuill/hugo-module-listenbrainz
- Owner: deuill
- License: mit
- Created: 2025-02-10T21:55:34.000Z (9 months ago)
- Default Branch: trunk
- Last Pushed: 2025-02-10T22:01:23.000Z (9 months ago)
- Last Synced: 2025-05-09T05:10:13.228Z (6 months ago)
- Topics: hugo, hugo-module, listenbrainz
- Language: HTML
- Homepage: https://go.deuill.org/hugo-module-listenbrainz
- Size: 2.93 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ListenBrainz Module for Hugo
A ready-to use module for Hugo, providing a layout and shortcode for adding a "Now Listening" widget
powered by [ListenBrainz][listenbrainz].
## Installation
Firstly, make sure to initialize the [Hugo module system][hugo-modules] for your site, if you haven't done so
already:
```sh
hugo mod init
```
Then, add the ListenBrainz module to your site configuration:
```yaml
module:
imports:
- path: go.deuill.org/hugo-module-listenbrainz
```
Remember to keep this and other modules on your site updated with `hugo mod get -u`.
## Configuration
By default, the ListenBrainz module expects to be configured in the site-wide configuration file,
e.g. for `hugo.yaml`:
```toml
params:
listenBrainz:
username: example
```
Which would fetch listening data for [listenbrainz.org/user/example][listenbrainz-example]. It is,
however, also possible to pass different usernames in both layout inclusions and shortcode
invocations; see the section below for more information.
## Use
The ListenBrainz module can be used as either a layout:
```html
{{- with .Site.Params.listenBrainz.username}}
{{partial "listenbrainz.html" .}}
{{- end}}
```
Or a short-code:
```markdown
# Example
Here's what I'm listening to right now:
{{< listenbrainz >}}
And here's what this other user is listening to:
{{< listenbrainz username="other" >}}
```
The short-code example above shows how a non-default username might also be specified; site-wide
configuration will be used if no specific username is given.
## License
All code in this repository is covered by the terms of the MIT License, the full text of which can be found in the LICENSE file.
[hugo-modules]: https://gohugo.io/hugo-modules/use-modules/#use-a-module-for-a-theme
[listenbrainz]: https://listenbrainz.org
[listenbrainz-example]: https://listenbrainz.org/user/example/